Index: /branches/eam_branches/ipp-dev-20210817/ippScripts/scripts/warp_overlap.pl
===================================================================
--- /branches/eam_branches/ipp-dev-20210817/ippScripts/scripts/warp_overlap.pl	(revision 41883)
+++ /branches/eam_branches/ipp-dev-20210817/ippScripts/scripts/warp_overlap.pl	(revision 41884)
@@ -150,8 +150,25 @@
 }
 
-# If no overlaps are found, we
-# keep running this step over and over (a successful warptool -addoverlap prevents
-# successive warptime -imfile from running.
-&my_die("Unable to find any overlaps", $warp_id, $PS_EXIT_PROG_ERROR) if scalar @overlaps == 0;
+# If no overlaps are found, the astrometry calibration was poor, but
+# not bad enough for the camera-stage quality to be marked as bad.
+# we set the warpRun state to 'fail' since no warpSkyCellMap can be generated.
+if (scalar @overlaps == 0) {
+    warn("no overlaps found (bad astrometry); setting warpRun state to 'fail'\n");
+
+    # Add the processed file to the database
+    unless ($no_update) {
+	my $command = "$warptool -updaterun -set_state fail"; # Command to run warptool
+	$command .= " -dbname $dbname" if defined $dbname;
+	
+	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	    run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    warn("Unable to perform warptool -updaterun -set_state fail: $error_code\n");
+	    exit($error_code);
+	}
+    }
+    exit(0);
+}
 
 # Generate a MDC file with the overlaps
