rust-lang/cargo · error · anyhow::Error
several `[patch]` entries resolving to same version `{} v{}`
Error message
several `[patch]` entries resolving to same version `{} v{}`
help: check `{}` patch definitions for `{}` in {} What it means
Error "several `[patch]` entries resolving to same version `{} v{}` help: check `{}` patch definitions for `{}` in {}" thrown in rust-lang/cargo.
Source
Thrown at src/workspace/registry.rs:459
url,
orig_patch.loc
));
}
Ok(summary)
}).collect::<CargoResult<Vec<_>>>()?;
let mut name_and_version = HashSet::default();
for summary in unlocked_summaries.iter() {
let name = summary.package_id().name();
let version = summary.package_id().version();
if !name_and_version.insert((name, version)) {
let duplicate_locations = patch_deps
.iter()
.filter(|&p| p.0.dep.package_name() == name)
.map(|p| format!("`{}`", p.0.loc))
.unique()
.join(", ");
return Err(anyhow::anyhow!(
"several `[patch]` entries resolving to same version `{} v{}`\n\
help: check `{}` patch definitions for `{}` in {}",
name,
version,
name,
url,
duplicate_locations
));
}
}
// Calculate a list of all patches available for this source.
let mut ids = Vec::new();
for (summary, (_, lock)) in unlocked_summaries.iter().zip(patch_deps) {
ids.push(summary.package_id());
// This is subtle where the list of `ids` for a canonical URL is
// extend with possibly two ids per summary. This is done to handle
// the transition from the v2->v3 lock file format where in v2View on GitHub (pinned to 0e07a15537)
Solutions
- Keep only one `[patch]` entry resolving to that version; remove or narrow the duplicates.
- Make patch definitions more specific so they do not overlap.
When it happens
Trigger: Thrown at src/workspace/registry.rs:459 when the library encounters an invalid state.
Common situations: Occurs when multiple `[patch]` entries resolve to the same package version. Consolidate or disambiguate the patch entries so only one patch resolves to that version.
AI-assisted analysis of rust-lang/cargo@0e07a15537 (2026-08-06).
Data as JSON: /data/errors/dccb8058fd89f6bb.json.
Report an issue: GitHub.