Handle IOExceptions from discovered headers when not all discovered headers were present in Skyframe.

PiperOrigin-RevId: 322987600
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionState.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionState.java
index 7bf085d..e9c4f24 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionState.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionState.java
@@ -18,6 +18,7 @@
 import com.google.devtools.build.lib.actions.Action;
 import com.google.devtools.build.lib.actions.ActionExecutionException;
 import com.google.devtools.build.lib.actions.ActionLookupData;
+import com.google.devtools.build.lib.bugreport.BugReport;
 import com.google.devtools.build.skyframe.SkyFunction;
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
@@ -131,6 +132,15 @@
         // a non-null value, or it registers a dependency with Skyframe and returns null; it must
         // not return null without registering a dependency, i.e., if {@code !env.valuesMissing()}.
         if (env.valuesMissing()) {
+          if (current.isDone()) {
+            // This can happen if there was an error in a dep, but another dep was missing. The
+            // Skyframe contract is that this SkyFunction should eagerly process that exception, so
+            // that errors can be transformed in --nokeep_going mode.
+            ActionExecutionValue value = current.get();
+            BugReport.sendBugReport(
+                new IllegalStateException(
+                    actionLookupData + " returned " + value + " with values missing"));
+          }
           return null;
         }
       }