{"record":{"id":"7f982abfdb26bffc","repo":"rust-lang/cargo","slug":"deprecated-dependency-sections-are-unsupported","errorCode":null,"errorMessage":"Deprecated dependency sections are unsupported: {}","messagePattern":"Deprecated dependency sections are unsupported: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/ops/cargo_add/mod.rs","lineNumber":88,"sourceCode":"    /// Whether the minimum supported Rust version should be considered during resolution\n    pub honor_rust_version: Option<bool>,\n}\n\n/// Add dependencies to a manifest\npub fn add(workspace: &Workspace<'_>, options: &AddOptions<'_>) -> CargoResult<()> {\n    let dep_table = options\n        .section\n        .to_table()\n        .into_iter()\n        .map(String::from)\n        .collect::<Vec<_>>();\n\n    let manifest_path = options.spec.manifest_path().to_path_buf();\n    let mut manifest = LocalManifest::try_new(&manifest_path)?;\n    let original_raw_manifest = manifest.to_string();\n    let legacy = manifest.get_legacy_sections();\n    if !legacy.is_empty() {\n        anyhow::bail!(\n            \"Deprecated dependency sections are unsupported: {}\",\n            legacy.join(\", \")\n        );\n    }\n\n    let mut registry = workspace.package_registry()?;\n\n    let deps = {\n        let _lock = options\n            .gctx\n            .acquire_package_cache_lock(CacheLockMode::DownloadExclusive)?;\n        registry.lock_patches();\n        options\n            .dependencies\n            .iter()\n            .map(|raw| {\n                resolve_dependency(\n                    &manifest,","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/rust-lang/cargo/blob/98a09e7e7d62850f14e5b6132101fc1edd19a16f/src/ops/cargo_add/mod.rs#L70-L106","documentation":"Thrown by the cargo add operation when the target manifest contains deprecated dependency section syntax that cargo add cannot safely modify. The get_legacy_sections() check identifies old-style sections that predate current manifest conventions.","triggerScenarios":"Running `cargo add <dep>` against a Cargo.toml that contains deprecated dependency section formats detected by LocalManifest::get_legacy_sections().","commonSituations":"Very old manifests with pre-2018 edition syntax. Manually edited manifests with non-standard section names. Manifests migrated through tooling that left legacy artifacts.","solutions":["Run `cargo fix --edition` or manually update the manifest to use modern dependency section syntax","Inspect the manifest for sections listed in the error and convert them to standard [dependencies] table format","Use `cargo migrate` or equivalent tooling to modernize the manifest before running cargo add"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check for legacy sections before running cargo add\nfn check_legacy_sections(manifest_path: &Path) -> Result<(), String> {\n    let content = std::fs::read_to_string(manifest_path).map_err(|e| e.to_string())?;\n    let toml_val: toml::Value = toml::from_str(&content).map_err(|e| e.to_string())?;\n    // Check for known deprecated section patterns\n    if let Some(table) = toml_val.as_table() {\n        for key in table.keys() {\n            if key.contains(\"_dependencies\") && !is_standard_dep_section(key) {\n                return Err(format!(\"deprecated section found: {key}\"));\n            }\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run cargo fix --edition to modernize old manifests before using cargo add","Keep manifests in modern syntax by upgrading editions proactively","Avoid manually creating non-standard dependency section names"],"tags":["cargo-add","manifest","deprecated"],"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"}