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

override found but no real ones

Error message

override found but no real ones

What it means

Error "override found but no real ones" thrown in rust-lang/cargo.

Source

Thrown at src/workspace/registry.rs:742

            kind: QueryKind,
            f: &mut dyn FnMut(IndexSummary),
        ) -> CargoResult<()> {
            source
                .query(dep, kind, f)
                .await
                .with_context(|| format!("unable to update {}", source.source_id()))
                .with_context(|| {
                    format!(
                        "failed to load source for dependency `{}`",
                        dep.package_name()
                    )
                })
        }

        let source = self.sources.borrow().get(dep.source_id()).cloned();
        match (override_summary, source) {
            (Some(_), None) => {
                return Err(anyhow::anyhow!("override found but no real ones"));
            }
            (None, None) => return Ok(()),

            // If we don't have an override then we just ship everything upstairs after locking the summary
            (None, Some(source)) => {
                for patch in patches.iter() {
                    f(IndexSummary::Candidate(patch.clone()));
                }

                // Our sources shouldn't ever come back to us with two summaries
                // that have the same version. We could, however, have an `[patch]`
                // section which is in use to override a version in the registry.
                // This means that if our `summary` in this loop has the same
                // version as something in `patches` that we've already selected,
                // then we skip this `summary`.
                let locked = &self.locked;
                let all_patches = &self.patches_available;
                let callback = &mut |summary: IndexSummary| {

View on GitHub (pinned to 0e07a15537)

Solutions

  1. Remove the `[replace]`/override entry, since there is no real package version to override.
  2. Add the dependency normally so the override has a real target.

When it happens

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

Common situations: Occurs when a `[patch]` or directory override is configured but the patched source contains no matching packages to override. Remove the stale override or fix the patch source.


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