Repository: bazelbuild/bazel
Issue: Print platform info with error message when -versbose_failures is selected
Labels: type: feature request
P1
team-Configurability


### Description of the problem / feature request:

Feature Request: Print platform info with error message when -verbose_failures is selected.

If a user passes the verbose_failures and the build fails, the error message should include some info about which platform was used to run the failed action.

### Feature requests: what underlying problem are you trying to solve with this feature?

Users can make simple mistakes that lead to incorrect platform being selected. Error message showing platform would help identify these kinds of issues very easily.


Issue comments:
Can you provide example output showing where the message should be?
This is a snippet from an output from a failed build for TF:

ERROR: /tmpfs/tmp/bazel/external/org_tensorflow/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/BUILD:206:1: Couldn't build file external/org_tensorflow/third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda/cuda/include/CL/cl.h: Executing genrule @org_tensorflow//third_party/toolchains/preconfig/ubuntu14.04/cuda9.0-cudnn7/cuda:cuda-include failed (Exit 1)
cp: cannot stat '/usr/local/cuda-9.0/include/CL/cl.h': No such file or directory
[9,866 / 10,412] 278 / 503 tests, 278 failed; no action

The error message coming from the use of --verbose_failures is:
"cp: cannot stat '/usr/local/cuda-9.0/include/CL/cl.h': No such file or directory"

This error occurred because the wrong platform was selected to run this action (due to a user mistake in flags)

It would have been ideal to get something like

cp: cannot stat '/usr/local/cuda-9.0/include/CL/cl.h': No such file or directory
Platform info: this action ran in <something about the platform that either shows all details here or points me to the platform target that was selected for this action>

Please let me know if you want more details / a more comprehensive example.


Pull request review comments:
nit: Bogus indentation, here and below.
Why null? Why cannot we use the same value as in the branch below?
Why all these no-op changes here? I mean, I guess they're fine, but they make it harder to see what actually changed :)
Sorry, I just wanted to shorten my new target, but my regex was a little greedy and fixed all of the local targets. I can revert everything except command-utils if you'd like.
In an ideal world, we'd have two different execution platforms here:
- The actual spawn's execution platform, which would describe the sandbox (and ideally give configuration for it)
- The sandbox's execution platform, which describes the environment that the sandbox container can run in.

We don't actually define either of these very well right now, but it's definitely wrong to assume they're the same, so it's best to just pass null and not describe it.
The formatter was confused because this is correct but previous commits left the indent wrong on the previous lines. Fixed it.
(I see now that the two branches are subtly different in what they call `get*` on.)

But can the platforms between the sandbox and the action ever be different?
One of my goals is to better couple execution strategies and platforms. Ideally, we'd end up with platform definitions like this (this is entirely a strawman, don't take any actual syntax seriously):

```
platform(name = "linux_sandbox",
  constraint_values = [...],
  execution_strategy = "linux-sandbox",
  execution_properties = """
    sandbox_base_dir: /tmp/sandbox
    sandbox_allow_networking: false
  """)

platform(name = "host",
  constraint_values = [...],
)
```

In this case, both of these are execution platforms, but "host" is the platform the sandbox runs on. They might have identical constraint_values, but they mean very different things.
Oh man, I was going to point you at someone else about this platform stuff... until I dug who "katre" was, so I cannot point you at yourself ;-)

Patch that resolved the issue:
diff --git a/src/main/java/com/google/devtools/build/lib/BUILD b/src/main/java/com/google/devtools/build/lib/BUILD
index 42c7e7fd28831a..3ed78099f9601c 100644
--- a/src/main/java/com/google/devtools/build/lib/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/BUILD
@@ -100,7 +100,7 @@ java_library(
         "//conditions:default": ["//src/main/native:libunix.so"],
     }),
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:os_util",
+        ":os_util",
         "//src/main/java/com/google/devtools/build/lib/concurrent",
         "//src/main/java/com/google/devtools/build/lib/profiler",
         "//src/main/java/com/google/devtools/build/lib/shell",
@@ -154,8 +154,8 @@ java_library(
     name = "process_util",
     srcs = ["util/ProcessUtils.java"],
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:os_util",
-        "//src/main/java/com/google/devtools/build/lib:unix",
+        ":os_util",
+        ":unix",
         "//src/main/java/com/google/devtools/build/lib/concurrent",
         "//src/main/java/com/google/devtools/build/lib/windows",
         "//src/main/java/com/google/devtools/build/lib/windows/jni:processes",
@@ -181,11 +181,28 @@ java_library(
     ],
 )
 
+COMMAND_UTILS_SRCS = [
+    "util/CommandFailureUtils.java",
+    "util/CommandUtils.java",
+]
+
+java_library(
+    name = "command-utils",
+    srcs = COMMAND_UTILS_SRCS,
+    deps = [
+        ":util",
+        "//src/main/java/com/google/devtools/build/lib/analysis/platform",
+        "//src/main/java/com/google/devtools/build/lib/shell",
+        "//third_party:guava",
+        "//third_party:jsr305",
+    ],
+)
+
 java_library(
     name = "util",
     srcs = glob(
         ["util/*.java"],
-        exclude = [
+        exclude = COMMAND_UTILS_SRCS + [
             "util/BlazeClock.java",
             "util/Clock.java",
             "util/ExitCode.java",
@@ -204,20 +221,20 @@ java_library(
         ],
     ),
     exports = [
-        "//src/main/java/com/google/devtools/build/lib:base-util",
-        "//src/main/java/com/google/devtools/build/lib:exitcode-external",
-        "//src/main/java/com/google/devtools/build/lib:filetype",
-        "//src/main/java/com/google/devtools/build/lib:os_util",
-        "//src/main/java/com/google/devtools/build/lib:resource_usage",
-        "//src/main/java/com/google/devtools/build/lib:string_util",
+        ":base-util",
+        ":exitcode-external",
+        ":filetype",
+        ":os_util",
+        ":resource_usage",
+        ":string_util",
         "//src/main/java/com/google/devtools/build/lib/clock",
         "//src/main/java/com/google/devtools/build/lib/collect",
     ],
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:base-util",
-        "//src/main/java/com/google/devtools/build/lib:exitcode-external",
-        "//src/main/java/com/google/devtools/build/lib:os_util",
-        "//src/main/java/com/google/devtools/build/lib:unix",
+        ":base-util",
+        ":exitcode-external",
+        ":os_util",
+        ":unix",
         "//src/main/java/com/google/devtools/build/lib/collect",
         "//src/main/java/com/google/devtools/build/lib/collect/compacthashset",
         "//src/main/java/com/google/devtools/build/lib/concurrent",
@@ -296,7 +313,7 @@ java_library(
     name = "events",
     srcs = glob(["events/*.java"]),
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:io",
+        ":io",
         "//src/main/java/com/google/devtools/build/lib/concurrent",
         "//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec",
         "//src/main/java/com/google/devtools/build/lib/vfs",
@@ -316,8 +333,8 @@ java_library(
 java_library(
     name = "foundation",
     exports = [
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":events",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/concurrent",
         "//src/main/java/com/google/devtools/build/lib/vfs",
         "//src/main/java/com/google/devtools/common/options",
@@ -332,9 +349,9 @@ java_library(
     name = "skylark-lang",
     visibility = ["//visibility:public"],
     exports = [
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:skylarkinterface",
-        "//src/main/java/com/google/devtools/build/lib:syntax",
+        ":events",
+        ":skylarkinterface",
+        ":syntax",
         "//src/main/java/com/google/devtools/build/lib/vfs",
         "//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
         "//src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs",
@@ -399,9 +416,9 @@ java_library(
         "syntax/**/*.java",
     ]),
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:skylarkinterface",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":events",
+        ":skylarkinterface",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/cmdline",
         "//src/main/java/com/google/devtools/build/lib/collect/nestedset",
         "//src/main/java/com/google/devtools/build/lib/concurrent",
@@ -446,17 +463,17 @@ java_library(
         exclude = ["packages/BuilderFactoryForTesting.java"],
     ),
     exports = [
-        "//src/main/java/com/google/devtools/build/lib:syntax",
+        ":syntax",
         "//src/main/java/com/google/devtools/build/lib/cmdline",
     ],
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:config-matching-provider",
-        "//src/main/java/com/google/devtools/build/lib:config-transitions",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:skylarkinterface",
-        "//src/main/java/com/google/devtools/build/lib:syntax",
-        "//src/main/java/com/google/devtools/build/lib:transitive-info-provider",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":config-matching-provider",
+        ":config-transitions",
+        ":events",
+        ":skylarkinterface",
+        ":syntax",
+        ":transitive-info-provider",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/buildeventstream",
         "//src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_java_proto",
         "//src/main/java/com/google/devtools/build/lib/cmdline",
@@ -491,8 +508,8 @@ java_library(
 java_library(
     name = "packages",
     exports = [
-        "//src/main/java/com/google/devtools/build/lib:foundation",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
+        ":foundation",
+        ":packages-internal",
     ],
 )
 
@@ -519,8 +536,8 @@ java_library(
         "analysis/ProviderCollection.java",
     ],
     deps = [
+        ":packages-internal",
         ":transitive-info-provider",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
         "//third_party:jsr305",
     ],
 )
@@ -532,7 +549,7 @@ java_library(
         "//src/main/java/com/google/devtools/build/lib/rules/config:__pkg__",
     ],
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:build-base",
+        ":build-base",
     ],
 )
 
@@ -574,24 +591,25 @@ java_library(
         "runtime/BuildEventStreamerUtils.java",
     ],
     exports = [
-        "//src/main/java/com/google/devtools/build/lib:transitive-info-provider",
+        ":transitive-info-provider",
     ],
     deps = [
+        ":base-util",
         ":build-request-options",
+        ":command-utils",
+        ":events",
+        ":exitcode-external",
+        ":io",
+        ":keep-going-option",
+        ":os_util",
+        ":packages-internal",
+        ":process_util",
         ":provider-collection",
-        "//src/main/java/com/google/devtools/build/lib:base-util",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:exitcode-external",
-        "//src/main/java/com/google/devtools/build/lib:io",
-        "//src/main/java/com/google/devtools/build/lib:keep-going-option",
-        "//src/main/java/com/google/devtools/build/lib:os_util",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:process_util",
-        "//src/main/java/com/google/devtools/build/lib:skylarkinterface",
-        "//src/main/java/com/google/devtools/build/lib:syntax",
-        "//src/main/java/com/google/devtools/build/lib:transitive-info-provider",
-        "//src/main/java/com/google/devtools/build/lib:unix",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":skylarkinterface",
+        ":syntax",
+        ":transitive-info-provider",
+        ":unix",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/actions:commandline_item",
         "//src/main/java/com/google/devtools/build/lib/actions:localhost_capacity",
@@ -651,22 +669,22 @@ java_library(
         ],
     ),
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:RpcSupport",
-        "//src/main/java/com/google/devtools/build/lib:android-rules",
-        "//src/main/java/com/google/devtools/build/lib:bazel",
-        "//src/main/java/com/google/devtools/build/lib:bazel-repository",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:build-info",
-        "//src/main/java/com/google/devtools/build/lib:core-rules",
-        "//src/main/java/com/google/devtools/build/lib:core-workspace-rules",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:java-compilation",
-        "//src/main/java/com/google/devtools/build/lib:java-rules",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:proto-rules",
-        "//src/main/java/com/google/devtools/build/lib:python-rules",
-        "//src/main/java/com/google/devtools/build/lib:testing-support-rules",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":RpcSupport",
+        ":android-rules",
+        ":bazel",
+        ":bazel-repository",
+        ":build-base",
+        ":build-info",
+        ":core-rules",
+        ":core-workspace-rules",
+        ":events",
+        ":java-compilation",
+        ":java-rules",
+        ":packages-internal",
+        ":proto-rules",
+        ":python-rules",
+        ":testing-support-rules",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/analysis/platform",
         "//src/main/java/com/google/devtools/build/lib/buildeventstream",
@@ -707,15 +725,15 @@ java_library(
     name = "bazel/BazelRepositoryModule",
     srcs = ["bazel/BazelRepositoryModule.java"],
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:bazel-commands",
-        "//src/main/java/com/google/devtools/build/lib:bazel-repository",
-        "//src/main/java/com/google/devtools/build/lib:bazel-rules",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:io",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:runtime",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":bazel-commands",
+        ":bazel-repository",
+        ":bazel-rules",
+        ":build-base",
+        ":events",
+        ":io",
+        ":packages-internal",
+        ":runtime",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/bazel/repository/cache",
         "//src/main/java/com/google/devtools/build/lib/bazel/repository/downloader",
         "//src/main/java/com/google/devtools/build/lib/cmdline",
@@ -737,20 +755,20 @@ java_library(
         "bazel/rules/python/python_stub_template.txt",
     ],
     deps = [
+        ":bazel",
+        ":bazel-commands",
         ":bazel-coverage",
+        ":bazel-modules",
+        ":bazel-repository",
+        ":bazel-rules",
         ":bazel/BazelRepositoryModule",
+        ":build-base",
+        ":build-info",
+        ":events",
         ":exitcode-external",
-        "//src/main/java/com/google/devtools/build/lib:bazel",
-        "//src/main/java/com/google/devtools/build/lib:bazel-commands",
-        "//src/main/java/com/google/devtools/build/lib:bazel-modules",
-        "//src/main/java/com/google/devtools/build/lib:bazel-repository",
-        "//src/main/java/com/google/devtools/build/lib:bazel-rules",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:build-info",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:io",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":io",
+        ":packages-internal",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/bazel/debug:workspace-rule-module",
         "//src/main/java/com/google/devtools/build/lib/bazel/repository/cache",
         "//src/main/java/com/google/devtools/build/lib/bazel/repository/downloader",
@@ -779,13 +797,13 @@ java_library(
         ],
     ),
     deps = [
+        ":build-base",
+        ":build-info",
+        ":events",
         ":exitcode-external",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:build-info",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:io",
-        "//src/main/java/com/google/devtools/build/lib:runtime",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":io",
+        ":runtime",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/shell",
         "//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec",
@@ -804,15 +822,15 @@ java_library(
         "bazel/commands/sync.txt",
     ],
     deps = [
+        ":build-base",
+        ":events",
+        ":exitcode-external",
+        ":java-compilation",
+        ":java-rules",
         ":keep-going-option",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:exitcode-external",
-        "//src/main/java/com/google/devtools/build/lib:java-compilation",
-        "//src/main/java/com/google/devtools/build/lib:java-rules",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:runtime",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":packages-internal",
+        ":runtime",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/query2",
         "//src/main/java/com/google/devtools/build/lib/query2:abstract-blaze-query-env",
         "//src/main/java/com/google/devtools/build/lib/query2:query-engine",
@@ -829,10 +847,10 @@ java_library(
     name = "bazel-coverage",
     srcs = glob(["bazel/coverage/*.java"]),
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:runtime",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":build-base",
+        ":events",
+        ":runtime",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/actions:localhost_capacity",
         "//src/main/java/com/google/devtools/build/lib/concurrent",
@@ -855,15 +873,15 @@ java_library(
         exclude = ["bazel/repository/MavenConnector.java"],
     ),
     deps = [
+        ":build-base",
+        ":events",
+        ":io",
+        ":maven-connector",
+        ":packages-internal",
+        ":runtime",
+        ":skylarkinterface",
+        ":util",
         "//src/java_tools/singlejar/java/com/google/devtools/build/zip",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:io",
-        "//src/main/java/com/google/devtools/build/lib:maven-connector",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:runtime",
-        "//src/main/java/com/google/devtools/build/lib:skylarkinterface",
-        "//src/main/java/com/google/devtools/build/lib:util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/bazel/debug:workspace-rule-event",
         "//src/main/java/com/google/devtools/build/lib/bazel/repository/cache",
@@ -909,9 +927,9 @@ java_library(
         ["rules/nativedeps/*.java"],
     ),
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":build-base",
+        ":packages-internal",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/collect",
         "//src/main/java/com/google/devtools/build/lib/collect/nestedset",
@@ -930,10 +948,10 @@ java_library(
         ["rules/proto/*.java"],
     ),
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:skylarkinterface",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":build-base",
+        ":packages-internal",
+        ":skylarkinterface",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/actions:commandline_item",
         "//src/main/java/com/google/devtools/build/lib/actions:localhost_capacity",
@@ -993,16 +1011,16 @@ java_library(
         "rules/java/proto/StrictDepsUtils.java",
     ],
     deps = [
+        ":RpcSupport",
+        ":build-base",
+        ":events",
+        ":java-compilation",
+        ":java-implicit-attributes",
+        ":packages-internal",
+        ":proto-rules",
         ":provider-collection",
-        "//src/main/java/com/google/devtools/build/lib:RpcSupport",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:java-compilation",
-        "//src/main/java/com/google/devtools/build/lib:java-implicit-attributes",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:proto-rules",
-        "//src/main/java/com/google/devtools/build/lib:skylarkinterface",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":skylarkinterface",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/collect",
         "//src/main/java/com/google/devtools/build/lib/collect/nestedset",
@@ -1026,10 +1044,10 @@ java_library(
     name = "RpcSupport",
     srcs = ["rules/java/proto/RpcSupport.java"],
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:java-compilation",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:proto-rules",
+        ":build-base",
+        ":java-compilation",
+        ":packages-internal",
+        ":proto-rules",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/collect",
         "//src/main/java/com/google/devtools/build/lib/collect/nestedset",
@@ -1086,14 +1104,14 @@ java_library(
         "rules/java/proto/GeneratedExtensionRegistryProvider.java",
     ],
     deps = [
+        ":build-base",
+        ":build-info",
+        ":events",
+        ":java-implicit-attributes",
+        ":packages-internal",
         ":provider-collection",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:build-info",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:java-implicit-attributes",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:skylarkinterface",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":skylarkinterface",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/actions:commandline_item",
         "//src/main/java/com/google/devtools/build/lib/actions:localhost_capacity",
@@ -1128,8 +1146,8 @@ java_library(
         ["rules/core/*.java"],
     ),
     deps = [
+        ":build-base",
         ":packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
         "//third_party:guava",
     ],
 )
@@ -1143,10 +1161,10 @@ java_library(
         "rules/repository/CoreWorkspaceRules.java",
     ],
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:core-rules",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":build-base",
+        ":core-rules",
+        ":packages-internal",
+        ":util",
         "//third_party:guava",
     ],
 )
@@ -1157,13 +1175,13 @@ java_library(
         ["rules/test/*.java"],
     ),
     deps = [
+        ":build-base",
+        ":core-rules",
         ":packages-internal",
         ":skylarkinterface",
+        ":syntax",
+        ":transitive-info-provider",
         ":util",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:core-rules",
-        "//src/main/java/com/google/devtools/build/lib:syntax",
-        "//src/main/java/com/google/devtools/build/lib:transitive-info-provider",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/buildeventstream",
         "//src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_proto",
@@ -1188,15 +1206,15 @@ java_library(
         "rules/android/test_suite_property_name.txt",
     ],
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:java-compilation",
-        "//src/main/java/com/google/devtools/build/lib:java-rules",
-        "//src/main/java/com/google/devtools/build/lib:nativedeps-rules",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:proto-rules",
-        "//src/main/java/com/google/devtools/build/lib:skylarkinterface",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":build-base",
+        ":events",
+        ":java-compilation",
+        ":java-rules",
+        ":nativedeps-rules",
+        ":packages-internal",
+        ":proto-rules",
+        ":skylarkinterface",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/actions:commandline_item",
         "//src/main/java/com/google/devtools/build/lib/actions:localhost_capacity",
@@ -1227,11 +1245,11 @@ java_library(
         ["rules/python/*.java"],
     ),
     deps = [
+        ":build-base",
         ":events",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:skylarkinterface",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":packages-internal",
+        ":skylarkinterface",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/collect",
         "//src/main/java/com/google/devtools/build/lib/collect/nestedset",
@@ -1251,12 +1269,12 @@ java_library(
 java_library(
     name = "shared-base-rules",
     exports = [
-        "//src/main/java/com/google/devtools/build/lib:android-rules",
-        "//src/main/java/com/google/devtools/build/lib:java-compilation",
-        "//src/main/java/com/google/devtools/build/lib:java-rules",
-        "//src/main/java/com/google/devtools/build/lib:nativedeps-rules",
-        "//src/main/java/com/google/devtools/build/lib:proto-rules",
-        "//src/main/java/com/google/devtools/build/lib:python-rules",
+        ":android-rules",
+        ":java-compilation",
+        ":java-rules",
+        ":nativedeps-rules",
+        ":proto-rules",
+        ":python-rules",
     ],
 )
 
@@ -1264,7 +1282,7 @@ java_library(
     name = "build-request-options",
     srcs = ["buildtool/BuildRequestOptions.java"],
     deps = [
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/actions:localhost_capacity",
         "//src/main/java/com/google/devtools/build/lib/vfs",
@@ -1295,11 +1313,11 @@ java_library(
         "server/IdleServerTasks.java",
     ],
     deps = [
+        ":exitcode-external",
+        ":io",
         ":runtime",
-        "//src/main/java/com/google/devtools/build/lib:exitcode-external",
-        "//src/main/java/com/google/devtools/build/lib:io",
-        "//src/main/java/com/google/devtools/build/lib:unix",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":unix",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/clock",
         "//src/main/java/com/google/devtools/build/lib/concurrent",
         "//src/main/java/com/google/devtools/build/lib/profiler",
@@ -1336,19 +1354,20 @@ java_library(
         "server/signal/InterruptSignalHandler.java",
     ],
     deps = [
+        ":build-base",
         ":build-request-options",
+        ":command-utils",
+        ":events",
+        ":exitcode-external",
+        ":io",
         ":keep-going-option",
         ":loading-phase-threads-option",
+        ":packages-internal",
+        ":process_util",
+        ":shared-base-rules",
+        ":unix",
+        ":util",
         "//src/main/java/com/google/devtools/build/docgen:docgen_javalib",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:exitcode-external",
-        "//src/main/java/com/google/devtools/build/lib:io",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:process_util",
-        "//src/main/java/com/google/devtools/build/lib:shared-base-rules",
-        "//src/main/java/com/google/devtools/build/lib:unix",
-        "//src/main/java/com/google/devtools/build/lib:util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/actions:localhost_capacity",
         "//src/main/java/com/google/devtools/build/lib/bazel/repository/downloader",
@@ -1414,17 +1433,17 @@ java_library(
         "runtime/commands/*.txt",
         "runtime/mobileinstall/*.txt",
     ]) + [
-        "//src/main/java/com/google/devtools/build/lib:runtime/commands/LICENSE",
+        ":runtime/commands/LICENSE",
     ],
-    exports = ["//src/main/java/com/google/devtools/build/lib:runtime"],
+    exports = [":runtime"],
 )
 
 java_library(
     name = "all-build-rules",
     exports = [
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:packages-internal",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":build-base",
+        ":packages-internal",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/concurrent",
         "//src/main/java/com/google/devtools/build/lib/graph",
@@ -1438,11 +1457,11 @@ java_library(
 java_library(
     name = "build",
     exports = [
-        "//src/main/java/com/google/devtools/build/lib:all-build-rules",
-        "//src/main/java/com/google/devtools/build/lib:build-base",
-        "//src/main/java/com/google/devtools/build/lib:foundation",
-        "//src/main/java/com/google/devtools/build/lib:packages",
-        "//src/main/java/com/google/devtools/build/lib:query2",
+        ":all-build-rules",
+        ":build-base",
+        ":foundation",
+        ":packages",
+        ":query2",
         "//src/main/java/com/google/devtools/build/lib/actions",
     ],
 )
@@ -1455,10 +1474,10 @@ java_library(
 java_library(
     name = "query2",
     exports = [
-        "//src/main/java/com/google/devtools/build/lib:events",
-        "//src/main/java/com/google/devtools/build/lib:foundation",
-        "//src/main/java/com/google/devtools/build/lib:packages",
-        "//src/main/java/com/google/devtools/build/lib:util",
+        ":events",
+        ":foundation",
+        ":packages",
+        ":util",
         "//src/main/java/com/google/devtools/build/lib/concurrent",
         "//src/main/java/com/google/devtools/build/lib/graph",
         "//src/main/java/com/google/devtools/build/lib/query2",
@@ -1477,9 +1496,9 @@ java_binary(
     ],
     main_class = "com.google.devtools.build.lib.bazel.Bazel",
     runtime_deps = [
+        ":bazel-main",
         ":server",
-        "//src/main/java/com/google/devtools/build/lib:bazel-main",
-        "//src/main/java/com/google/devtools/build/lib:single-line-formatter",  # See startup_options.cc
+        ":single-line-formatter",  # See startup_options.cc
     ],
 )
 
@@ -1501,7 +1520,7 @@ filegroup(
 
 genrule(
     name = "gen_buildencyclopedia",
-    srcs = ["//src/main/java/com/google/devtools/build/lib:docs_embedded_in_sources"],
+    srcs = [":docs_embedded_in_sources"],
     outs = ["build-encyclopedia.zip"],
     cmd = (
         "mkdir -p $(@D)/be && " +
@@ -1540,7 +1559,7 @@ genrule(
         "cat $(location //site:command-line-reference-suffix.html) >> $@"
     ),
     tools = [
-        "//src/main/java/com/google/devtools/build/lib:bazel/BazelServer",
+        ":bazel/BazelServer",
     ],
     visibility = [
         "//site:__pkg__",
diff --git a/src/main/java/com/google/devtools/build/lib/actions/BUILD b/src/main/java/com/google/devtools/build/lib/actions/BUILD
index 005e53593ae9cb..430e3a39fff3f9 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/actions/BUILD
@@ -30,6 +30,7 @@ java_library(
     deps = [
         ":commandline_item",
         ":localhost_capacity",
+        "//src/main/java/com/google/devtools/build/lib:command-utils",
         "//src/main/java/com/google/devtools/build/lib:events",
         "//src/main/java/com/google/devtools/build/lib:io",
         "//src/main/java/com/google/devtools/build/lib:packages-internal",
diff --git a/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java
index e186975dd59463..d8908639fbabb0 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java
@@ -147,7 +147,8 @@ public List<SpawnResult> exec(
                   actionExecutionContext.getVerboseFailures(),
                   spawn.getArguments(),
                   spawn.getEnvironment(),
-                  cwd);
+                  cwd,
+                  spawn.getExecutionPlatform());
       throw new SpawnExecException(message, spawnResult, /*forciblyRunRemotely=*/false);
     }
     return ImmutableList.of(spawnResult);
diff --git a/src/main/java/com/google/devtools/build/lib/query2/BUILD b/src/main/java/com/google/devtools/build/lib/query2/BUILD
index 3ccf9fb5bd2fc0..dea8203a771ded 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/query2/BUILD
@@ -23,6 +23,7 @@ java_library(
         ":query-engine",
         ":query-output",
         "//src/main/java/com/google/devtools/build/lib:build-base",
+        "//src/main/java/com/google/devtools/build/lib:command-utils",
         "//src/main/java/com/google/devtools/build/lib:events",
         "//src/main/java/com/google/devtools/build/lib:packages-internal",
         "//src/main/java/com/google/devtools/build/lib:util",
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java
index 5610242eaaefbb..2d4eb2487c824f 100644
--- a/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java
+++ b/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java
@@ -123,19 +123,25 @@ private final SpawnResult run(
         sandbox.getArguments().toArray(new String[0]),
         sandbox.getEnvironment(),
         sandbox.getSandboxExecRoot().getPathFile());
-      String failureMessage;
-      if (sandboxOptions.sandboxDebug) {
-        failureMessage =
-            CommandFailureUtils.describeCommandFailure(
-                true, sandbox.getArguments(), sandbox.getEnvironment(), execRoot.getPathString());
-      } else {
-        failureMessage =
-            CommandFailureUtils.describeCommandFailure(
-                verboseFailures,
-                originalSpawn.getArguments(),
-                originalSpawn.getEnvironment(),
-                execRoot.getPathString()) + SANDBOX_DEBUG_SUGGESTION;
-      }
+    String failureMessage;
+    if (sandboxOptions.sandboxDebug) {
+      failureMessage =
+          CommandFailureUtils.describeCommandFailure(
+              true,
+              sandbox.getArguments(),
+              sandbox.getEnvironment(),
+              execRoot.getPathString(),
+              null);
+    } else {
+      failureMessage =
+          CommandFailureUtils.describeCommandFailure(
+                  verboseFailures,
+                  originalSpawn.getArguments(),
+                  originalSpawn.getEnvironment(),
+                  execRoot.getPathString(),
+                  originalSpawn.getExecutionPlatform())
+              + SANDBOX_DEBUG_SUGGESTION;
+    }
 
     long startTime = System.currentTimeMillis();
     CommandResult commandResult;
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/BUILD b/src/main/java/com/google/devtools/build/lib/sandbox/BUILD
index c8da1fd574f4af..5298b94b03f16d 100644
--- a/src/main/java/com/google/devtools/build/lib/sandbox/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/sandbox/BUILD
@@ -17,6 +17,7 @@ java_library(
     ],
     deps = [
         "//src/main/java/com/google/devtools/build/lib:build-base",
+        "//src/main/java/com/google/devtools/build/lib:command-utils",
         "//src/main/java/com/google/devtools/build/lib:events",
         "//src/main/java/com/google/devtools/build/lib:io",
         "//src/main/java/com/google/devtools/build/lib:packages-internal",
diff --git a/src/main/java/com/google/devtools/build/lib/util/CommandFailureUtils.java b/src/main/java/com/google/devtools/build/lib/util/CommandFailureUtils.java
index 5317e818c962cb..df3f666f8e9315 100644
--- a/src/main/java/com/google/devtools/build/lib/util/CommandFailureUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/util/CommandFailureUtils.java
@@ -18,6 +18,7 @@
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Ordering;
+import com.google.devtools.build.lib.analysis.platform.PlatformInfo;
 import java.io.File;
 import java.util.Collection;
 import java.util.Comparator;
@@ -225,39 +226,50 @@ public static String describeCommand(
   }
 
   /**
-   * Construct an error message that describes a failed command invocation.
-   * Currently this returns a message of the form "error executing command foo
-   * bar baz".
+   * Construct an error message that describes a failed command invocation. Currently this returns a
+   * message of the form "error executing command foo bar baz".
    */
   public static String describeCommandError(
       boolean verbose,
       Collection<String> commandLineElements,
       Map<String, String> env,
-      String cwd) {
+      String cwd,
+      @Nullable PlatformInfo executionPlatform) {
 
     CommandDescriptionForm form = verbose
         ? CommandDescriptionForm.COMPLETE
         : CommandDescriptionForm.ABBREVIATED;
-    return "error executing command " + (verbose ? "\n  " : "")
-        + describeCommand(form, /* prettyPrintArgs= */false, commandLineElements, env, cwd);
+
+    StringBuilder output = new StringBuilder();
+    output.append("error executing command ");
+    if (verbose) {
+      output.append("\n  ");
+    }
+    output.append(
+        describeCommand(form, /* prettyPrintArgs= */ false, commandLineElements, env, cwd));
+    if (verbose && executionPlatform != null) {
+      output.append("\n");
+      output.append("Execution platform: ").append(executionPlatform.label());
+    }
+    return output.toString();
   }
 
   /**
-   * Construct an error message that describes a failed command invocation.
-   * Currently this returns a message of the form "foo failed: error executing
-   * command /dir/foo bar baz".
+   * Construct an error message that describes a failed command invocation. Currently this returns a
+   * message of the form "foo failed: error executing command /dir/foo bar baz".
    */
   public static String describeCommandFailure(
       boolean verbose,
       Collection<String> commandLineElements,
       Map<String, String> env,
-      String cwd) {
+      String cwd,
+      @Nullable PlatformInfo executionPlatform) {
 
     String commandName = commandLineElements.iterator().next();
     // Extract the part of the command name after the last "/", if any.
     String shortCommandName = new File(commandName).getName();
-    return shortCommandName + " failed: " +
-        describeCommandError(verbose, commandLineElements, env, cwd);
+    return shortCommandName
+        + " failed: "
+        + describeCommandError(verbose, commandLineElements, env, cwd, executionPlatform);
   }
-
 }
diff --git a/src/main/java/com/google/devtools/build/lib/util/CommandUtils.java b/src/main/java/com/google/devtools/build/lib/util/CommandUtils.java
index ef2d18d1d48c9a..35c5d887d7532c 100644
--- a/src/main/java/com/google/devtools/build/lib/util/CommandUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/util/CommandUtils.java
@@ -18,7 +18,6 @@
 import com.google.devtools.build.lib.shell.Command;
 import com.google.devtools.build.lib.shell.CommandException;
 import com.google.devtools.build.lib.shell.CommandResult;
-
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Map;
@@ -48,8 +47,8 @@ private static String cwd(Command command) {
    * bar baz".
    */
   public static String describeCommandError(boolean verbose, Command command) {
-    return CommandFailureUtils.describeCommandError(verbose, commandLine(command), env(command),
-                                                    cwd(command));
+    return CommandFailureUtils.describeCommandError(
+        verbose, commandLine(command), env(command), cwd(command), null);
   }
 
   /**
@@ -58,8 +57,8 @@ public static String describeCommandError(boolean verbose, Command command) {
    * command /dir/foo bar baz".
    */
   public static String describeCommandFailure(boolean verbose, Command command) {
-    return CommandFailureUtils.describeCommandFailure(verbose, commandLine(command), env(command),
-                                                      cwd(command));
+    return CommandFailureUtils.describeCommandFailure(
+        verbose, commandLine(command), env(command), cwd(command), null);
   }
 
   /**


Test patch:
diff --git a/src/test/java/com/google/devtools/build/lib/BUILD b/src/test/java/com/google/devtools/build/lib/BUILD
index 147f68e698923a..31a9ef2225b561 100644
--- a/src/test/java/com/google/devtools/build/lib/BUILD
+++ b/src/test/java/com/google/devtools/build/lib/BUILD
@@ -318,9 +318,12 @@ java_test(
         ":guava_junit_truth",
         ":test_runner",
         ":testutil",
+        "//src/main/java/com/google/devtools/build/lib:command-utils",
         "//src/main/java/com/google/devtools/build/lib:simple-log-handler",
         "//src/main/java/com/google/devtools/build/lib:single-line-formatter",
         "//src/main/java/com/google/devtools/build/lib:util",
+        "//src/main/java/com/google/devtools/build/lib/analysis/platform",
+        "//src/main/java/com/google/devtools/build/lib/cmdline",
         "//src/main/java/com/google/devtools/build/lib/shell",
         "//src/main/java/com/google/devtools/build/lib/skyframe/serialization/testutils",
         "//src/main/java/com/google/devtools/build/lib/vfs",
diff --git a/src/test/java/com/google/devtools/build/lib/util/CommandFailureUtilsTest.java b/src/test/java/com/google/devtools/build/lib/util/CommandFailureUtilsTest.java
index f13758eecc359b..0ce5b5c423ac15 100644
--- a/src/test/java/com/google/devtools/build/lib/util/CommandFailureUtilsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/util/CommandFailureUtilsTest.java
@@ -15,6 +15,8 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import com.google.devtools.build.lib.analysis.platform.PlatformInfo;
+import com.google.devtools.build.lib.cmdline.Label;
 import java.util.Arrays;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -38,9 +40,14 @@ public void describeCommandError() throws Exception {
     env.put("FOO", "foo");
     env.put("PATH", "/usr/bin:/bin:/sbin");
     String cwd = "/my/working/directory";
-    String message = CommandFailureUtils.describeCommandError(false, Arrays.asList(args), env, cwd);
+    PlatformInfo executionPlatform =
+        PlatformInfo.builder().setLabel(Label.parseAbsoluteUnchecked("//platform:exec")).build();
+    String message =
+        CommandFailureUtils.describeCommandError(
+            false, Arrays.asList(args), env, cwd, executionPlatform);
     String verboseMessage =
-        CommandFailureUtils.describeCommandError(true, Arrays.asList(args), env, cwd);
+        CommandFailureUtils.describeCommandError(
+            true, Arrays.asList(args), env, cwd, executionPlatform);
     assertThat(message)
         .isEqualTo(
             "error executing command some_command arg1 "
@@ -60,7 +67,8 @@ public void describeCommandError() throws Exception {
                 + "arg11 arg12 arg13 arg14 arg15 arg16 arg17 arg18 "
                 + "arg19 arg20 arg21 arg22 arg23 arg24 arg25 arg26 "
                 + "arg27 arg28 arg29 arg30 arg31 arg32 arg33 arg34 "
-                + "arg35 arg36 arg37 arg38 arg39)");
+                + "arg35 arg36 arg37 arg38 arg39)\n"
+                + "Execution platform: //platform:exec");
   }
 
   @Test
@@ -73,10 +81,14 @@ public void describeCommandFailure() throws Exception {
     env.put("FOO", "foo");
     env.put("PATH", "/usr/bin:/bin:/sbin");
     String cwd = null;
+    PlatformInfo executionPlatform =
+        PlatformInfo.builder().setLabel(Label.parseAbsoluteUnchecked("//platform:exec")).build();
     String message =
-        CommandFailureUtils.describeCommandFailure(false, Arrays.asList(args), env, cwd);
+        CommandFailureUtils.describeCommandFailure(
+            false, Arrays.asList(args), env, cwd, executionPlatform);
     String verboseMessage =
-        CommandFailureUtils.describeCommandFailure(true, Arrays.asList(args), env, cwd);
+        CommandFailureUtils.describeCommandFailure(
+            true, Arrays.asList(args), env, cwd, executionPlatform);
     assertThat(message)
         .isEqualTo(
             "sh failed: error executing command "
@@ -87,7 +99,8 @@ public void describeCommandFailure() throws Exception {
                 + "  (exec env - \\\n"
                 + "    FOO=foo \\\n"
                 + "    PATH=/usr/bin:/bin:/sbin \\\n"
-                + "  /bin/sh -c 'echo Some errors 1>&2; echo Some output; exit 42')");
+                + "  /bin/sh -c 'echo Some errors 1>&2; echo Some output; exit 42')\n"
+                + "Execution platform: //platform:exec");
   }
 
   @Test