Index: trunk/pstamp/scripts/pstamp_parser_run.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_parser_run.pl	(revision 18539)
+++ trunk/pstamp/scripts/pstamp_parser_run.pl	(revision 18587)
@@ -121,5 +121,5 @@
 
 my $new_uri;
-if ($ds_id) {
+if ($ds_id && ($uri =~ /^http:/)) {
     {
         $new_uri = "$workdir/request.fits";
@@ -183,16 +183,28 @@
 if ($request_type eq "PS1_PS_REQUEST") {
     $reqType = 'pstamp';
-    $parse_cmd = $pstampparse . " --mode queue_job --req_id $req_id --product $product --out_dir $outProductDir --file $uri";
-    $parse_cmd .= " --dbname $dbname" if $dbname;
+    $parse_cmd = $pstampparse;
 } elsif ($request_type eq "MOPS_DETECTABILITY_QUERY") {
     $reqType = 'dquery';
-    $parse_cmd = $dqueryparse  . " --mode queue_job --req_id $req_id --out_dir $outProductDir --uri $uri";
+    $parse_cmd = $dqueryparse;
 }
 
 if (!$parse_cmd) {
-    # XXX TODO mark the error state for the job and set it to stop
-    die "null request type found in $uri" if !$request_type;
-    die "unknown request type $request_type found in $uri";
-}
+    print STDERR "No EXTNAME found in $uri" if !$request_type;
+    print STDERR "Unknown request type $request_type found in $uri";
+
+    my $command = "$pstamptool -processedreq -req_id $req_id -state run";
+    $command   .= " -reqType unknown";
+    $command   .= " -fault $PS_EXIT_DATA_ERROR";
+    $command   .= " -dbname $dbname" if $dbname;
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        die("Unable to perform $command error code: $error_code");
+    }
+    exit $PS_EXIT_DATA_ERROR;
+}
+
+$parse_cmd .= " --mode queue_job --req_id $req_id --product $product --out_dir $outProductDir --file $uri";
+$parse_cmd .= " --dbname $dbname" if $dbname;
 
 my $fault;
@@ -211,8 +223,9 @@
     if ($errbuf) {
         if (!open OUT, ">$error_file_name") {
-            die("unable to open parse_error file $error_file_name");
+            print STDERR ("unable to open parse_error file $error_file_name");
+        } else {
+            print OUT "$errbuf";
+            close(OUT);
         }
-        print OUT "$errbuf";
-        close(OUT);
         print STDERR $errbuf if $verbose;
     }
@@ -241,5 +254,5 @@
 # Note: We do not return $fault here. If there was a fatal error we've already exited.
 # If we got a fault it's due to bad input from the user we've set things up for this to be
-# handled by the pstamp.request.finish
+# handled by the task pstamp.request.finish
 
 exit 0;
