rust-lang/cargo · error
packages downloaded
Error message
packages downloaded
What it means
Invariant in the feature resolver: `has_any_proc_macro` does `self.package_set.get_one(package_id).expect("packages downloaded")`. By the time feature resolution runs, the package set should have all packages downloaded; `get_one` returning an error means a package is missing from the set.
Source
Thrown at src/resolver/features.rs:961
"{}/{:?} features mismatch\nresolve: {:?}\nnew: {:?}\n",
pkg_id,
dep_kind,
r_features,
features
);
found = true;
}
}
if found {
panic!("feature mismatch");
}
}
/// Whether the given package has any proc macro target, including proc-macro examples.
fn has_any_proc_macro(&self, package_id: PackageId) -> bool {
self.package_set
.get_one(package_id)
.expect("packages downloaded")
.proc_macro()
}
/// Whether the given package is a proc macro lib target.
///
/// This is useful for checking if a dependency is a proc macro,
/// as it is not possible to depend on a non-lib target as a proc-macro.
fn has_proc_macro_lib(&self, package_id: PackageId) -> bool {
self.package_set
.get_one(package_id)
.expect("packages downloaded")
.library()
.map(|lib| lib.proc_macro())
.unwrap_or_default()
}
}
View on GitHub (pinned to 0e07a15537)
Solutions
- `cargo clean` and clear `~/.cargo/registry/cache` + `~/.cargo/git/checkouts`, then retry.
- Check disk space and permissions on the cargo home directory.
- Run with `CARGO_NET_RETRY=10` and `-v` to surface network failures hidden before the panic.
- Verify `[patch]`/git deps resolve to a real crate: `cargo fetch -p <name>`.
Defensive patterns
Strategy: validation
Validate before calling
// Ensure all packages are fetched before feature resolution.
for id in package_set.package_ids() {
package_set.get_one(id)?; // surface download errors explicitly
} Prevention
- Run `cargo fetch` first to materialize all packages and surface network errors early.
- Keep the registry/git cache clean and disk with free space.
- Set `CARGO_NET_RETRY` to tolerate transient fetch failures.
When it happens
Trigger: Fires if the feature resolver queries a `package_id` that the `package_set` cannot provide — typically because downloads were incomplete, a source returned no data, or the package id is stale (mismatched with what was actually fetched).
Common situations: Interrupted/corrupted download cache; a `[patch]` or `[replace]` pointing at an empty source; a git dependency that fetched but produced no matching package; running cargo with concurrent cache mutations; disk-full / permission errors during download that were silently swallowed.
Related errors
- in the non-empty branch
- manifest validated
- We've already checked that there is exactly one.
- source ID should have valid URLs
- parent not currently active!?
AI-assisted analysis of rust-lang/cargo@0e07a15537 (2026-08-06).
Data as JSON: /data/errors/897fe8d86fe31975.json.
Report an issue: GitHub.