bazelbuild / bazelbuild/bazel

query "@bazel_tools/..." fails

Open
#19,668 0 comments 0 reactions 0 assignees View on GitHub
help wanted P2 team-ExternalDeps type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

`bazel query "@bazel_tools//tools/..."` works fine and lists a number of labels

However:
```
$ bazel query "@bazel_tools//..."
ERROR: error loading package under directory '': error loading package '@bazel_tools//src/main/protobuf': Unable to find package for @com_google_protobuf//:protobuf.bzl: The repository '@com_google_protobuf' could not be resolved: Repository '@com_google_protobuf' is not defined.\
```

### Which category does this issue belong to?

_No response_

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

set up any simple workspace and run `bazel query "@bazel_tools/..."`

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

Debian GNU/Linux rodete

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

release 6.3.2

### 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_

### Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

_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 reproducing the failure with `bazel query "@bazel_tools//..."` in a simple workspace, then compare it with `bazel query "@bazel_tools//tools/..."`. Investigate why loading `@bazel_tools//src/main/protobuf` cannot resolve `@com_google_protobuf`; done means the broad query succeeds without the reported repository error.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.