rust-lang/cargo · error · anyhow::Error

found patches and a path override

Error message

found patches and a path override

What it means

Error "found patches and a path override" thrown in rust-lang/cargo.

Source

Thrown at src/workspace/registry.rs:777

                let all_patches = &self.patches_available;
                let callback = &mut |summary: IndexSummary| {
                    for patch in patches.iter() {
                        let patch = patch.package_id().version();
                        if summary.package_id().version() == patch {
                            return;
                        }
                    }
                    let summary = summary.map_summary(|summary| lock(locked, all_patches, summary));
                    f(summary)
                };
                return query_with_context(&*source, dep, kind, callback).await;
            }

            // If we have an override summary then we query the source to sanity check its results.
            // We don't actually use any of the summaries it gives us though.
            (Some(override_summary), Some(source)) => {
                if !patches.is_empty() {
                    return Err(anyhow::anyhow!("found patches and a path override"));
                }
                let mut n = 0;
                let mut to_warn = None;
                let callback = &mut |summary| {
                    n += 1;
                    match summary {
                        IndexSummary::Candidate(summary)
                        | IndexSummary::Yanked(summary)
                        | IndexSummary::Offline(summary)
                        | IndexSummary::Unsupported(summary, _)
                        | IndexSummary::Invalid(summary) => {
                            to_warn = Some(summary);
                        }
                    }
                };
                query_with_context(&*source, dep, kind, callback).await?;
                if n > 1 {
                    return Err(anyhow::anyhow!("found an override with a non-locked list"));

View on GitHub (pinned to 0e07a15537)

Solutions

  1. Use either `[patch]` entries or a path override (`.cargo/config` paths), not both.
  2. Remove the path override or the patch section.

When it happens

Trigger: Thrown at src/workspace/registry.rs:777 when the library encounters an invalid state.

Common situations: Occurs when both `[patch]` entries and a `paths` override (e.g. `.cargo/config.toml` `paths`) apply to the same source. Use only one override mechanism at a time.


AI-assisted analysis of rust-lang/cargo@0e07a15537 (2026-08-06). Data as JSON: /data/errors/23d5f9c73b5311fb.json. Report an issue: GitHub.