Report #35538
[bug\_fix] failed to select a version for the requirement \`crate = "^x.y.z"\`
Run \`cargo update\` to refresh \`Cargo.lock\` to the latest compatible versions within the specified SemVer ranges. If incompatible major versions are required \(e.g., crate A needs Tokio 0.2, crate B needs Tokio 1.0\), upgrade the dependent crates in \`Cargo.toml\` to versions that agree on the same major version of the shared dependency, or use \`cargo tree -d\` to identify the conflict. Root cause: Cargo's resolver cannot find a version of the crate that satisfies all SemVer constraints imposed by different packages in the dependency graph \(often due to major version incompatibility\).
Journey Context:
Developer adds \`hyper = "0.14"\` to an existing project that already uses \`tokio = "0.2"\`. \`cargo build\` fails with "failed to select a version for \`tokio\`". Developer runs \`cargo tree\` and sees that \`hyper 0.14\` requires \`tokio ^1.0\`, while their code uses \`tokio 0.2\`. They try \`cargo update\` but it doesn't help because 0.2 and 1.0 are incompatible major versions. Developer must either downgrade \`hyper\` to a version that supports Tokio 0.2 \(if available\) or upgrade their own code to Tokio 1.0 \(which requires editing their \`Cargo.toml\` and fixing breaking API changes\). In another case, the error is about a single crate where \`Cargo.lock\` is pinned to an old version; \`cargo update -p crate\_name\` resolves it by updating the lockfile to the latest patch version allowed by the SemVer requirement in \`Cargo.toml\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:07:03.075954+00:00— report_created — created