bazelbuild / bazelbuild/bazel

Improve error output to include target label that produced failed actions

Open
#18,139 2 comments 4 reactions 0 assignees View on GitHub
team-Core type: feature request untriaged
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the feature request:

It can be difficult or impossible to determine the target label when a build action fails. It should be easy to determine a target label to build in order to reproduce a build failure when viewing build log output.

Often the target can be guessed by looking at the failed action info and the relevant BUILD file, but this does not work when a repo uses config transitions.

See https://github.com/alex-torok/example-transition-build for an example where build log output does not produce enough information to reproduce a build failure. You must look at detailed build event data to find the top-level configured target to run a build command on.

The bazel log output should print some information about the top-level configured target that resulted in a particular build action failing.

### What underlying problem are you trying to solve with this feature?

CI jobs often build large parts of a repo. When looking at the log output from the CI job, someone should be able to reproduce the failure locally with a `bazel build //some:target`. This process is often difficult or impossible to do purely from bazel's stderr log output.

### Which operating system are you running Bazel on?

_No response_

### What is the output of `bazel info release`?

5.3.1

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by comparing Bazel's stderr output for a failed build action with the detailed build event data from the example-transition-build repository. Identify where the top-level configured target is available and determine how failed-action log output could expose it, then verify that the output supports reproducing the failure with a bazel build //some:target command.

Written by the indexing model from the issue text.

Assessment

Tech stack
build-system
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.