rust-lang/cargo · error · anyhow::Error
patch for `{}` points to the same source, but patches must p
Error message
patch for `{}` points to the same source, but patches must point to different sources
help: check `{}` patch definition for `{}` in `{}` What it means
Error "patch for `{}` points to the same source, but patches must point to different sources help: check `{}` patch definition for `{}` in `{}`" thrown in rust-lang/cargo.
Source
Thrown at src/workspace/registry.rs:436
let (summary, should_unlock) =
summary_for_patch(&orig_patch, url, &locked, summaries, source.as_ref())
.await?;
Ok::<_, anyhow::Error>((orig_patch, dep, summary, should_unlock))
});
}
let unlocked_summaries = crate::util::block_on_stream(pending).map(|next| {
let (orig_patch, dep, summary, should_unlock) = next?;
debug!(
"patch summary is {:?} should_unlock={:?}",
summary, should_unlock
);
if let Some(unlock_id) = should_unlock {
unlock_patches.push(((*orig_patch).clone(), unlock_id));
}
if *summary.package_id().source_id().canonical_url() == canonical {
return Err(anyhow::anyhow!(
"patch for `{}` points to the same source, but patches must point to different sources\n\
help: check `{}` patch definition for `{}` in `{}`",
dep.package_name(),
dep.package_name(),
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()View on GitHub (pinned to 0e07a15537)
Solutions
- Point the `[patch]` entry to a different source (e.g. a git fork or local path) instead of the same source it patches.
- Remove the patch entry if it is redundant.
When it happens
Trigger: Thrown at src/workspace/registry.rs:436 when the library encounters an invalid state.
Common situations: Occurs when a `[patch]` entry points to the same source it is meant to patch. Patches must come from a different source (different registry, git URL, or path); adjust the patch location.
AI-assisted analysis of rust-lang/cargo@0e07a15537 (2026-08-06).
Data as JSON: /data/errors/78763b5f350075eb.json.
Report an issue: GitHub.