diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java index 4de2fbbbeb0274..8fc740763a6aac 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java @@ -85,16 +85,16 @@ private ActionExecutionValue( for (Map.Entry tree : treeArtifactData.entrySet()) { for (Map.Entry file : tree.getValue().getChildValues().entrySet()) { - Preconditions.checkArgument( - file.getValue().getType() == FileStateType.REGULAR_FILE, - "file %s in tree artifact %s is not a regular file", - file.getKey(), - tree.getKey()); - Preconditions.checkArgument( - file.getValue().getDigest() != null, - "missing digest for file %s in tree artifact %s", - file.getKey(), - tree.getKey()); + // We should only have RegularFileValue instances in here, but apparently tree artifacts + // sometimes store their own root directory in here. Sad. + // https://github.com/bazelbuild/bazel/issues/9058 + if (file.getValue().getType() == FileStateType.REGULAR_FILE) { + Preconditions.checkArgument( + file.getValue().getDigest() != null, + "missing digest for file %s in tree artifact %s", + file.getKey(), + tree.getKey()); + } } }