Safeguard
Supply Chain•

Bazel says a module is yanked: what does it mean and what to do?

A yanked module version is one a registry marks as best avoided, for example after a vulnerability. Bazel errors on it by default. Here is how to respond.

Safeguard Security Team
3 min read

A yanked module version is one the registry says should be avoided, such as because of a security vulnerability. Bazel stops with an error if module resolution selects it. Upgrade to a newer, non-yanked version. Allow the yanked one only as a short, documented exception.

Definition

Bazel module registries can declare certain versions of a module as yanked. The registry's metadata file for a module has a yanked versions field: a JSON object whose keys are versions and whose values describe why, ideally with a link to more information. When resolution picks a yanked version, Bazel throws an error.

What to do, in order

  1. Read the reason. The yank message is your first piece of evidence. If it links to an advisory, read it.
  2. Find out who pulls it in. Use the module graph command to see which module depends on the yanked version, and the explain command to list every place the module appears.
  3. Upgrade. Bump your direct dependency, or bump the module that requests the old one. Because Bazel picks the highest version any dependent requests, raising the minimum in one place can fix it.
  4. Pin if you must. A single version override can pin a module to a specific version regardless of what the graph requests. Only the root module's overrides apply.
  5. Allow only with a deadline. A flag lets the build proceed with a yanked version. Record why, who approved it and when it expires.

What gets recorded

If you do allow a yanked version, the lockfile stores it in a section for selected yanked versions, because yank data is mutable and cannot be referenced by hash. That section is only non-empty when yanked versions are explicitly allowed. A diff that adds an entry there is a clear review trigger.

Keeping the signal fresh

Yank information changes after you resolve. The default lockfile mode avoids refreshing mutable information for dependencies that have not changed. A scheduled job in refresh mode picks up new yanks, so a version that was fine last month can fail loudly this month.

ModeNotices a new yank?
updateNot for unchanged dependencies
refreshYes, when switching to it and roughly hourly while in it
errorNo network during resolution

What a yank is not

It is not proof that you were attacked, and it is not a full vulnerability database. Registries yank for many reasons. Also, a clean resolution does not mean the module is free of known issues. Scan the dependency inventory separately.

Quick check

Will a yanked version silently build?

No. Bazel errors when resolution selects one, unless you explicitly allow yanked versions with a flag or environment variable.

How do I see who depends on a yanked module?

Use the module command with the explain subcommand, which shows where the module appears and which modules directly depend on it.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.