protocolbuffers / protocolbuffers/protobuf

Bazel: "`crates` is in a non-root module but has no lockfile" since rules_rust 0.71.1

Open
#28,224 0 comments 1 reaction 1 assignee View on GitHub

@esrauchg is already working on this.

Since Jun 30, 2026.

bug rust
Dominant language
C++
Stars
72k
Forks
16.3k
Avg merge
1d 17h
Merged PRs (30d)
140

Description

What version of protobuf and what language are you using?
Version: 35.1

Language: Rust

What supported operating system version are you using (e.g. Linux, Windows)?
Linux

What supported runtime / compiler version are you using (e.g. python version, gcc version)
Bazel 9.1.1 with rules_rust 0.71.1

What did you do?
In a root Bazel module that transitively depends on protobuf, force rules_rust to 0.71.1 and run bazel mod deps.
protobuf invokes the crate_universe extension unconditionally because it is not a dev dependency, and calls crate.from_specs() without a lockfile.

What did you expect to see
Resolution succeeds, because protobuf's crate_universe usage only supports protobuf's own Rust targets, which consumers do not depend on.

What did you see instead?
Resolution fails, because rules_rust 0.71.1 rejects any non-root crate_universe call that does not set lockfile:

crate_universe extension call `crates` is in a non-root module but has no lockfile. Transitive crate_universe repositories must ship a `lockfile = ...` because repinning is not supported across module boundaries.

Anything else we should know about your project / environment
Would it possible to supply a lockfile?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.