Bazel "error loading package" in CI
Bazel reached the BUILD file but could not evaluate it. A Starlark error, a failed load() of a .bzl, or an undefined symbol stops the package from loading.
What this error means
Loading fails with "error loading package <pkg>:" followed by a Starlark traceback pointing at a line in a BUILD or .bzl file. The build never reaches analysis.
ERROR: error loading package 'libs/auth': Unable to load file
'@rules_go//go:def.bzl': no such file or directory
ERROR: Skipping '//libs/auth:all': error loading package 'libs/auth'Common causes
load() points at a missing or wrong file
A load() statement references a .bzl file or repository that does not exist or was renamed, so evaluation fails before any target is defined.
Starlark syntax or symbol error
A typo, missing import, or undefined name in the BUILD/.bzl file raises a Starlark error during loading.
Repository not declared
The @repo in a load() is not defined in WORKSPACE or MODULE.bazel, so the file cannot be resolved.
How to fix it
Read the traceback to the failing line
- Open the BUILD or .bzl file named in the error at the reported line.
- Fix the load path, symbol, or syntax it points to.
Verify the loaded repo and symbol exist
- Confirm the @repo is declared in MODULE.bazel or WORKSPACE.
- Confirm the .bzl exports the symbol you load.
bazel query '@rules_go//go:def.bzl'How to prevent it
- Run buildifier and a bazel query //... in CI so load and Starlark errors surface before merge.