`cargo update` is non-deterministic + updates unrelated crates (w/ reproduction)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Problem
Hi, I have a small reproduction of cargo update updating the lockfile in a non deterministic way.
It enters some kind of "hysteresis", flipping between two package versions after each call to cargo update.
Also, the packages that are updated are not related to the requested package.
Steps
Even though the reproduction depends on some Windows-only crates, the issue reproduces on Linux as well. (To compile on Linux, use cargo check --target x86_64-pc-windows-gnu after installing the relevant toolchain. To run cargo update zip you don't need need any toolchains.)
- Download small sample project: https://github.com/nikita-island/cargo-update-flickering
- Run
cargo update zip, observewindows-coreupdated iniana-time-zoneandwmi, the last is unrelated tozip. Nowcargo checkis broken. - Run
cargo update zipagain, observewindows-corereverted to the old version. Nowcargo checkworks again. - Subsequent invocations flip the state again and again.
Possible Solution(s)
No response
Notes
I tries to pin the dependencies as strictly as possible so that the reproduction keeps working even if the crates themselves will be updated.
But if the reproduction stop working for some reason, I have a shell transcript in the readme of the reproduction repo.
(Also tried in nightly)
Version
cargo 1.94.1 (29ea6fb6a 2026-03-24)
release: 1.94.1
commit-hash: 29ea6fb6a5db279426f4cc4e17aa385f05a0cfbc
commit-date: 2026-03-24
host: x86_64-unknown-linux-gnu
libgit2: 1.9.2 (sys:0.20.3 vendored)
libcurl: 8.15.0-DEV (sys:0.4.83+curl-8.15.0 vendored ssl:OpenSSL/3.5.4)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Fedora 43.0.0 [64-bit]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Download the linked cargo-update-flickering reproduction and follow the listed cargo update zip and cargo check steps, comparing the lockfile after repeated updates. Start by tracing the cargo update behavior for the requested package and its dependency resolution. Done means repeated updates are stable, unrelated packages are not changed, and the reproduction continues to pass cargo check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100