{"id":"117f5d4e7922a2ce","repo":"rust-lang/cargo","slug":"packages-downloaded","errorCode":null,"errorMessage":"packages downloaded","messagePattern":"packages downloaded","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ops/cargo_compile/mod.rs","lineNumber":1228,"sourceCode":"        .activated_features(package_id, FeaturesFor::NormalOrDev)\n        .iter()\n        .map(|s| s.to_string())\n        .collect();\n\n    // Include features enabled for use by dependencies so targets can also use them with the\n    // required-features field when deciding whether to be built or skipped.\n    let filtered_deps = PackageSet::filter_deps(\n        package_id,\n        resolve_with_overrides,\n        has_dev_units,\n        requested_kinds,\n        target_data,\n        force_all_targets,\n    );\n    for (dep_id, deps) in filtered_deps {\n        let is_proc_macro = package_set\n            .get_one(dep_id)\n            .expect(\"packages downloaded\")\n            .proc_macro();\n        for dep in deps {\n            let features_for = FeaturesFor::from_for_host(is_proc_macro || dep.is_build());\n            for feature in resolved_features\n                .activated_features_unverified(dep_id, features_for)\n                .unwrap_or_default()\n            {\n                features.insert(format!(\"{}/{}\", dep.name_in_toml(), feature));\n            }\n        }\n    }\n\n    features\n}\n","sourceCodeStart":1210,"sourceCodeEnd":1243,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/ops/cargo_compile/mod.rs#L1210-L1243","documentation":"This panic is in build_unit_features() during compilation. It calls package_set.get_one(dep_id).expect(\"packages downloaded\") to check if a dependency is a proc-macro. The invariant is that by the time feature resolution runs, all packages in the dependency graph have already been downloaded and are available in the PackageSet. If get_one() returns an error (package not found), the expect panics.","triggerScenarios":"Compiling a project where a dependency in the resolved graph was never downloaded — this could happen if the download step was skipped, if the PackageSet was constructed incompletely, or if a dependency was added to the resolution after the download phase.","commonSituations":"Corrupted or incomplete cargo cache (~/.cargo/registry); a cargo internal bug where feature resolution runs before package downloads complete; a network interruption during cargo fetch that was not properly detected; using cargo as a library with an incompletely populated PackageSet.","solutions":["Run cargo fetch to ensure all packages are downloaded: cargo fetch.","Clear the cargo registry cache and re-download: rm -rf ~/.cargo/registry && cargo fetch.","Regenerate Cargo.lock: rm Cargo.lock && cargo generate-lockfile.","Check network connectivity to the registry and retry the build."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Before compiling, ensure all packages are downloaded\ncargo fetch\n// Verify registry cache is populated\nlet registry_cache = dirs::home_dir().unwrap().join(\".cargo/registry\");\nif !registry_cache.exists() {\n    eprintln!(\"registry cache missing; run cargo fetch\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run cargo fetch before building in CI or offline environments.","Clear and re-download the registry cache if corrupted: rm -rf ~/.cargo/registry && cargo fetch.","Regenerate Cargo.lock if dependency metadata is inconsistent.","Check network connectivity to the registry before building."],"tags":["rust","cargo","panic","invariant","cargo-compile","package-download","registry"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}