Accept valid relative symlinks in TreeArtifacts.

--
MOS_MIGRATED_REVID=137072310
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionMetadataHandler.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionMetadataHandler.java
index 9a82af3..28f6763 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionMetadataHandler.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionMetadataHandler.java
@@ -352,7 +352,17 @@
         // We do not cache exceptions besides nonexistence here, because it is unlikely that the
         // file will be requested from this cache too many times.
         if (fileValue == null) {
-          fileValue = constructFileValue(treeFileArtifact, /*statNoFollow=*/ null);
+          try {
+            fileValue = constructFileValue(treeFileArtifact, /*statNoFollow=*/ null);
+          } catch (FileNotFoundException e) {
+            String errorMessage = String.format(
+                "Failed to resolve relative path %s inside TreeArtifact %s. "
+                + "The associated file is either missing or is an invalid symlink.",
+                treeFileArtifact.getParentRelativePath(),
+                treeFileArtifact.getParent().getExecPathString());
+            throw new IOException(errorMessage, e);
+          }
+
           // A minor hack: maybeStoreAdditionalData will force the data to be stored
           // in additionalOutputData.
           maybeStoreAdditionalData(treeFileArtifact, fileValue, null);