Skip to content
Latchkey

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.

bazel
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

  1. Check the registry for the versions that actually exist for the module.
  2. Update the bazel_dep version to one that is published.
  3. Re-run resolution to confirm the module is found.
MODULE.bazel
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.

.bazelrc
common --registry=https://bcr.bazel.build
common --registry=https://registry.internal.example.com

How to prevent it

  • Reference only versions published to a configured registry.
  • Set private registries in .bazelrc so CI and local match.
  • Run bazel mod graph after MODULE.bazel edits to catch missing modules.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →