Bazel bzlmod "module not found in registry" in CI
With bzlmod, Bazel resolves each bazel_dep against the configured registries (the Bazel Central Registry by default). When no registry lists the module name or the requested version, resolution fails and names the missing module.
What this error means
Resolution fails with "ERROR: In module dependency chain ... module rules_foo@1.2.3 not found in registries" or a similar registry lookup failure.
ERROR: In module dependency chain <root> -> rules_foo@1.2.3:
rules_foo@1.2.3 not found in registries: [https://bcr.bazel.build/]Common causes
The version is not published to the registry
The module exists but the exact version in bazel_dep was never published to the Bazel Central Registry.
A private module without its registry configured
An internal module lives in a private registry that CI does not have configured via --registry.
How to fix it
Pin a published version
- Check the registry for the versions that actually exist for the module.
- Update the
bazel_depversion to one that is published. - Re-run resolution to confirm the module is found.
bazel_dep(name = "rules_foo", version = "1.2.0")Add the private registry in CI
Configure the additional registry so internal modules resolve, ideally in .bazelrc so every command uses it.
common --registry=https://bcr.bazel.build
common --registry=https://registry.internal.example.comHow to prevent it
- Reference only versions published to a configured registry.
- Set private registries in .bazelrc so CI and local match.
- Run
bazel mod graphafter MODULE.bazel edits to catch missing modules.