{"id":"dccb8058fd89f6bb","repo":"rust-lang/cargo","slug":"several-patch-entries-resolving-to-same-versio","errorCode":null,"errorMessage":"several `[patch]` entries resolving to same version `{} v{}`\nhelp: check `{}` patch definitions for `{}` in {}","messagePattern":"several `\\[patch\\]` entries resolving to same version `(.+?) v(.+?)`\nhelp: check `(.+?)` patch definitions for `(.+?)` in (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/registry.rs","lineNumber":459,"sourceCode":"                    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()\n                    .filter(|&p| p.0.dep.package_name() == name)\n                    .map(|p| format!(\"`{}`\", p.0.loc))\n                    .unique()\n                    .join(\", \");\n                return Err(anyhow::anyhow!(\n                    \"several `[patch]` entries resolving to same version `{} v{}`\\n\\\n                    help: check `{}` patch definitions for `{}` in {}\",\n                    name,\n                    version,\n                    name,\n                    url,\n                    duplicate_locations\n                ));\n            }\n        }\n\n        // Calculate a list of all patches available for this source.\n        let mut ids = Vec::new();\n        for (summary, (_, lock)) in unlocked_summaries.iter().zip(patch_deps) {\n            ids.push(summary.package_id());\n            // This is subtle where the list of `ids` for a canonical URL is\n            // extend with possibly two ids per summary. This is done to handle\n            // the transition from the v2->v3 lock file format where in v2","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/registry.rs#L441-L477","documentation":"Error \"several `[patch]` entries resolving to same version `{} v{}`\nhelp: check `{}` patch definitions for `{}` in {}\" thrown in rust-lang/cargo.","triggerScenarios":"Thrown at src/workspace/registry.rs:459 when the library encounters an invalid state.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}