diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java index fb64daef55db96..418ead4630750e 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java @@ -437,8 +437,9 @@ private static final class ArtifactFunctionException extends SkyFunctionExceptio private static String constructErrorMessage(Artifact artifact, String error) { Label ownerLabel = artifact.getOwner(); - if (ownerLabel == null) { - // Discovered inputs may not have an owner. + if (ownerLabel == null || ownerLabel.getName().equals(".")) { + // Discovered inputs may not have an owner. Directory source artifacts may be owned by a label + // ':.' which will crash toPathFragment below. return String.format("%s '%s'", error, artifact.getExecPathString()); } else if (ownerLabel.toPathFragment().equals(artifact.getExecPath())) { // No additional useful information from path.