1.1.7 bazel info

bazel info is the command you reach for when you no longer want to infer Bazel's filesystem layout from log lines, symlinks, or guesswork. It asks the current Bazel instance for concrete paths and runtime metadata: where the workspace root is, which output_base identifies the active server, where actions see their files, and where the current configuration writes binaries or test logs1,2,3.

What each bazel info path points to
Workspace symlinks are only shortcuts. The real state lives under output_base.
WORKSPACE
workspace repo root
/repo
visible checkout
MODULE.bazel
app/
tools/
Convenience only. These links may be absent when the repo root is not writable.
OUTPUT_BASE
output_base Bazel's files for this workspace
.../_bazel_user/<hash>
server/
daemon files and logs
command.log
last command output
action_cache/
cached action metadata
execution_root execroot/_main
MODULE.bazel
app/
tools/
...
Working tree visible to actions.
output_path bazel-out/
<config>/
bin/
built binaries and outputs
testlogs/
test XML and log files
server_pid
ID of the running Bazel server
server_log
Bazel server log
command_log
output from the last command
release
the exact Bazel version string
These keys report the running server and version. They do not name additional directories.
workspace names the repo root. output_base contains Bazel's files for this workspace. execution_root and bazel-out live inside it. bazel-bin and bazel-testlogs point to outputs for the selected configuration.

Ask Bazel For One Key

Running plain bazel info prints a long key-value listing. In day-to-day work, the more useful form is bazel info <key>, which prints only one value and is especially convenient in scripts1.

bazel info workspace
bazel info output_base
bazel info bazel-bin

That small habit pays off quickly. When a path matters, ask Bazel instead of assuming that bazel-bin exists as a symlink in the workspace, or that all state lives in one obvious cache directory on disk1,2.

Keep Three Roots Separate

Most path confusion comes from collapsing three different roots into one.

workspace is the absolute path to the base workspace directory1. It is the quickest sanity check that Bazel recognized the repository boundary correctly.

output_base is the per-user, per-workspace state root1. Bazel places scratch data and build output below it, and the client/server architecture uses it to decide which long-lived server process a bazel invocation should talk to1,3. If two invocations use different output bases, they are talking to different servers, even in the same repository. That is the concrete operator-facing side of 1.1.3 Server/Client Architecture.

execution_root sits underneath output_base and is the root of the files visible to commands executed during the build1,2,4. In non-sandboxed local execution it is the working directory for those commands4. If the workspace directory is writable, Bazel also places a bazel-<workspace> symlink at the repo root pointing here1.

output_base is the whole Bazel state tree, execution_root is the action-visible working tree inside it, and bazel-out is the output subtree under that execution root. 0.1.4 Output Root introduced the visible symlinks. bazel info gives you the real paths behind them1,2.

Convenience Paths Follow The Current Configuration

The most practical info keys are usually bazel-bin and bazel-testlogs, because they answer "where did Bazel put the thing I want to inspect?"1 But they are configuration-specific, not universal constants.

There is an important subtlety here: bazel info accepts the same analysis-affecting options that change output directories, such as --cpu or --compilation_mode1. That means these two commands can legitimately point at different directories:

bazel info -c dbg bazel-bin
bazel info -c opt bazel-bin

This is why scripts should prefer bazel info bazel-bin over assuming the workspace symlink exists or hard-coding a path under bazel-out/1. The workspace-level bazel-bin, bazel-testlogs, and bazel-out names are convenience symlinks only. Bazel itself does not rely on them, and it creates them only when the workspace root is writable1,2.

If you need the broader directory rather than the convenience leaf, output_path points at the actual bazel-out directory under the execution root1. That is often the missing link when bazel-bin is too narrow but output_base is too broad.

Useful Diagnostic Keys Beyond Paths

A few non-path keys also belong in the normal debugging toolkit.

bazel info is a locator, not a full debugger. It locates state and identifies the Bazel instance you are interrogating. To interpret that state, move outward: 1.1.3 Server/Client Architecture for server identity, 1.1.4 Inspecting Server State for the warm in-memory state, 2.4.2 Where Bazel Caches Things for the cache layers, and 1.1.6 bazel clean for what happens when you delete parts of it.

key takeaway

Use bazel info whenever the question is "where is it?" or "which Bazel instance am I talking to?" workspace tells you the repo root, output_base identifies the full state tree and server, execution_root shows the action-visible working tree, and bazel-bin / bazel-testlogs point to the current configuration's output directories.

Check your understanding · 2 questions

1.Match each bazel info key to the path it reports:

Drag each answer onto the matching prompt, or click an answer and then click a prompt

Answers
output_base
execution_root
bazel-bin

2.Why should scripts prefer bazel info bazel-bin over assuming ./bazel-bin exists?

Select one answer

0 of 2 answered

Footnotes

  1. Commands and Optionsbazel info <key>, configuration-independent vs configuration-specific keys, output_path, server_pid, server_log, command_log, and reliable use of bazel-bin 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

  2. Output Directory Layout — workspace symlinks as convenience only, output_base layout, execroot, and where bazel-out, bin, and testlogs sit 1 2 3 4 5

  3. Client/server implementation — output base as server identity and why different output bases mean different Bazel server processes 1 2

  4. Bazel Glossary — precise definitions of execution_root and install_base, including their related bazel info keys 1 2 3

  5. Calling Bazel from scriptscommand_log lookup and the caveat that bazel info overwrites the most recent command log contents 1 2