{"id":"78763b5f350075eb","repo":"rust-lang/cargo","slug":"patch-for-points-to-the-same-source-but-patc","errorCode":null,"errorMessage":"patch for `{}` points to the same source, but patches must point to different sources\nhelp: check `{}` patch definition for `{}` in `{}`","messagePattern":"patch for `(.+?)` points to the same source, but patches must point to different sources\nhelp: check `(.+?)` patch definition for `(.+?)` in `(.+?)`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/registry.rs","lineNumber":436,"sourceCode":"                let (summary, should_unlock) =\n                    summary_for_patch(&orig_patch, url, &locked, summaries, source.as_ref())\n                        .await?;\n                Ok::<_, anyhow::Error>((orig_patch, dep, summary, should_unlock))\n            });\n        }\n\n        let unlocked_summaries = crate::util::block_on_stream(pending).map(|next| {\n            let (orig_patch, dep, summary, should_unlock) = next?;\n            debug!(\n                \"patch summary is {:?} should_unlock={:?}\",\n                summary, should_unlock\n            );\n            if let Some(unlock_id) = should_unlock {\n                unlock_patches.push(((*orig_patch).clone(), unlock_id));\n            }\n\n            if *summary.package_id().source_id().canonical_url() == canonical {\n                return Err(anyhow::anyhow!(\n                    \"patch for `{}` points to the same source, but patches must point to different sources\\n\\\n                    help: check `{}` patch definition for `{}` in `{}`\",\n                    dep.package_name(),\n                    dep.package_name(),\n                    url,\n                    orig_patch.loc\n                ));\n            }\n            Ok(summary)\n        }).collect::<CargoResult<Vec<_>>>()?;\n\n        let mut name_and_version = HashSet::default();\n        for summary in unlocked_summaries.iter() {\n            let name = summary.package_id().name();\n            let version = summary.package_id().version();\n            if !name_and_version.insert((name, version)) {\n                let duplicate_locations = patch_deps\n                    .iter()","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/registry.rs#L418-L454","documentation":"Error \"patch for `{}` points to the same source, but patches must point to different sources\nhelp: check `{}` patch definition for `{}` in `{}`\" thrown in rust-lang/cargo.","triggerScenarios":"Thrown at src/workspace/registry.rs:436 when the library encounters an invalid state.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}