Guard WalkableGraph#getDirectDeps debugging call: in a no-keep-going build, the nodes won't be in the graph /sadface. Thus the debugging added by https://github.com/bazelbuild/bazel/commit/aa8fac57ff9e3b505671b9a41a2b8ee1c7fd786b was pretty useless. Still hope it will trigger in a keep-going build.

We could add a method to get the deps of undone nodes, but probably not worth it just for this.

PiperOrigin-RevId: 302750695
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java
index 8a2b4e7..4564b33 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java
@@ -770,6 +770,15 @@
         do {
           path.add(currentKey);
           foundDep = false;
+
+          Map<SkyKey, Exception> missingMap =
+              walkableGraph.getMissingAndExceptions(ImmutableList.of(currentKey));
+          if (missingMap.containsKey(currentKey) && missingMap.get(currentKey) == null) {
+            // This can happen in a no-keep-going build, where we don't write the bubbled-up error
+            // nodes to the graph.
+            break;
+          }
+
           for (SkyKey dep : walkableGraph.getDirectDeps(currentKey)) {
             if (cause.equals(walkableGraph.getException(dep))) {
               currentKey = dep;