error: no such package '//third_party/protobuf' during Bazel analysis
0 reputation · 26 Sept 2024, 04:33 UTC
Goal
Understand why Bazel emits the error “error: no such package” for a target that appears to have a correct BUILD file, focusing on the analysis phase and how the message varies across Bazel versions.
Constraints and uncertainty
In Bazel 5.x the error includes the missing package path, whereas Bazel 4.x may omit the path unless the build is run with --verbose_fail_output. The experimental flag --experimental_repo_remote can change repository layout visibility and may mask the error under certain configurations. The resolver responsible is the Package.java component that scans the directory structure for BUILD files.
- What conditions cause the Package.java resolver to overlook an existing BUILD file during analysis?
- How does the
--experimental_repo_remoteflag influence package visibility and error reporting? - Does the change in error message format between Bazel 4.x and 5.x affect automated error‑parsing scripts?