Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful error message when lockfile prevents version matching #10391

Closed
jonhoo opened this issue Feb 15, 2022 · 0 comments · Fixed by #10449
Closed

Unhelpful error message when lockfile prevents version matching #10391

jonhoo opened this issue Feb 15, 2022 · 0 comments · Fixed by #10449
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug

Comments

@jonhoo
Copy link
Contributor

jonhoo commented Feb 15, 2022

Problem

If Cargo.lock pins version 1.x.y of a dependency, and --locked or --frozen is passed, but 1.x.y is not available in the underlying registry, the error Cargo produces is fairly confusing. For example:

error: failed to select a version for the requirement `autocfg = "^1"`
candidate versions found which didn't match: 1.1.0

Nothing in the error mentions the lockfile or the use of --locked or --frozen.

Steps

$ cargo new --bin issue
$ cd issue
$ echo 'autocfg = "<1.1.0"' >> Cargo.toml
$ cargo generate-lockfile
$ cp Cargo.lock Cargo.lock.orig
$ sed -i.bkp 's/<1.1.0/1/' Cargo.toml
$ mkdir -p .cargo
$ cargo vendor > .cargo/config
$ cp Cargo.lock.orig Cargo.lock
$ cargo check --frozen # also happens with --locked
error: failed to select a version for the requirement `autocfg = "^1"`
candidate versions found which didn't match: 1.1.0
location searched: directory source `/local/home/jongje/issue/vendor` (which is replacing registry `crates-io`)
required by package `issue v0.1.0 (/local/home/jongje/issue)`
perhaps a crate was updated and forgotten to be re-vendored?

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.58.0 (f01b232bc 2022-01-19)
release: 1.58.0
commit-hash: f01b232bc7f4d94f0c4603930a5a96277715eb8c
commit-date: 2022-01-19
host: x86_64-unknown-linux-gnu
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/1.1.1l)
os: Amazon Linux AMI 2.0.0 [64-bit]
@jonhoo jonhoo added the C-bug Category: bug label Feb 15, 2022
@weihanglo weihanglo added the A-diagnostics Area: Error and warning messages generated by Cargo itself. label Feb 25, 2022
@bors bors closed this as completed in 72873d8 Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants