{"record":{"id":"2de7bd13e4a932b5","repo":"rust-lang/cargo","slug":"found-an-override-with-a-non-locked-list","errorCode":null,"errorMessage":"found an override with a non-locked list","messagePattern":"found an override with a non-locked list","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/workspace/registry.rs","lineNumber":815,"sourceCode":"                    return Err(anyhow::anyhow!(\"found patches and a path override\"));\n                }\n                let mut n = 0;\n                let mut to_warn = None;\n                let callback = &mut |summary| {\n                    n += 1;\n                    match summary {\n                        IndexSummary::Candidate(summary)\n                        | IndexSummary::Yanked(summary)\n                        | IndexSummary::Offline(summary)\n                        | IndexSummary::Unsupported(summary, _)\n                        | IndexSummary::Invalid(summary) => {\n                            to_warn = Some(summary);\n                        }\n                    }\n                };\n                query_with_context(&*source, dep, kind, callback).await?;\n                if n > 1 {\n                    return Err(anyhow::anyhow!(\"found an override with a non-locked list\"));\n                }\n                if let Some(to_warn) = to_warn {\n                    self.warn_bad_override(&override_summary, &to_warn)?;\n                }\n                let override_summary = self.lock(override_summary);\n                f(IndexSummary::Candidate(override_summary));\n            }\n        }\n\n        Ok(())\n    }\n\n    fn describe_source(&self, id: SourceId) -> String {\n        match self.sources.borrow().get(id) {\n            Some(src) => src.describe(),\n            None => id.to_string(),\n        }\n    }","sourceCodeStart":797,"sourceCodeEnd":833,"githubUrl":"https://github.com/rust-lang/cargo/blob/98a09e7e7d62850f14e5b6132101fc1edd19a16f/src/workspace/registry.rs#L797-L833","documentation":"When a path override is active, the underlying source must return exactly one summary (the locked candidate). After querying, the registry checks `if n > 1` (registry.rs:801) and bails: multiple summaries mean the source list is not locked, so the override is ambiguous. This protects against overrides pointing at sources with several matching versions.","triggerScenarios":"A path override is set for a dependency, and the overridden source returns more than one version summary during the query callback (incrementing `n` past 1).","commonSituations":"Overriding a path that contains multiple versions of the crate. A lock file that no longer pins the override to a single version. Source index changes that surface additional summaries.","solutions":["Run `cargo update <dep>` to re-lock the dependency to a single version.","Ensure the override path/git source contains exactly one matching version.","Delete the lock file and regenerate it with `cargo generate-lockfile`."],"exampleFix":"# before: override path has multiple versions, lock stale\n# (run:)\n# cargo generate-lockfile && cargo build\n\n# after: lock pins a single version, override resolves cleanly","handlingStrategy":"retry","validationCode":"// Ensure override source yields a single version\nfn override_is_locked(versions: &[semver::Version]) -> bool {\n    versions.len() == 1\n}","typeGuard":null,"tryCatchPattern":"// on \"found an override with a non-locked list\":\n//   cargo generate-lockfile && cargo build","preventionTips":["Keep lock files committed and current.","Ensure override paths/git sources contain one matching version.","Run `cargo update <dep>` after changing override targets."],"tags":["cargo","registry","override","lock-file","version-resolution"],"backgroundTag":null,"analyzedSha":"98a09e7e7d62850f14e5b6132101fc1edd19a16f","analyzedAt":"2026-08-11T17:42:36.556Z","contentChangedAt":"2026-08-11T17:42:36.556Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}