In-project `--output_user_root` triggers the repo contents cache error, even though the target directory is excluded with `.bazelignore`
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
After upgrading bazel from 8.2.1 to 8.3.0, I started to see an error like
```
ERROR: The repo contents cache [/home/runner/work/rules_build_error/rules_build_error/.cache/bazel/cache/repos/v1/contents] is inside the workspace [/home/runner/work/rules_build_error/rules_build_error]. This can cause spurious failures. Disable the repo contents cache with `--repo_contents_cache=`, or specify `--repo_contents_cache=`.
```
when setting `--output_user_root` to the directory inside the project. (I guess this was brought by [this commit](https://github.com/bazelbuild/bazel/commit/ad74aa5d9e29e7d4ab3043328ee25901be9e14f6))
However, this error happens even when that cache directory is listed in .bazelignore, though the directory is ignored and therefore won't cause any spurious failures.
### Which category does this issue belong to?
External Dependency
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
When using bazel 8.3.0,
(1) add a line
```
startup --output_user_root=.cache/bazel
```
to .bazelrc
(2) add a line
```
.cache
```
to .bazelignore
(3) execute a `bazel` command
(If I comment out the line in .bazelrc the error disappears)
### Which operating system are you running Bazel on?
ubuntu 22.04, 24.04
### What is the output of `bazel info release`?
release 8.3.0
### 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 HEAD` ?
N/A (using the released version)
### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
https://github.com/bazelbuild/bazel/commit/ad74aa5d9e29e7d4ab3043328ee25901be9e14f6
### Have you found anything relevant by searching the web?
N/A
### Any other information, logs, or outputs that you want to share?
Here I put some CI logs indicating the issue:
* https://github.com/yuyawk/rules_build_error/actions/runs/15871801864/job/44749934685
* https://github.com/yuyawk/rules_build_error/actions/runs/15845818368/job/44667642912
* https://github.com/yuyawk/libc_replacer/actions/runs/15871755131/job/44749774518
* https://github.com/yuyawk/libc_replacer/actions/runs/15845772215/job/44667489698
Contributor guide
Assessment
This issue has not been assessed yet.