{"id":"4f044d3d73931be2","repo":"rust-lang/cargo","slug":"unrecognized-dependency-entry-format-for-key","errorCode":null,"errorMessage":"Unrecognized` dependency entry format for `{key}`","messagePattern":"Unrecognized` dependency entry format for `(.+?)`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/editor/dependency.rs","lineNumber":380,"sourceCode":"            };\n\n            let optional = table.get(\"optional\").and_then(|v| v.as_bool());\n            let public = table.get(\"public\").and_then(|v| v.as_bool());\n\n            let dep = Self {\n                name,\n                optional,\n                public,\n                features,\n                default_features,\n                inherited_features: None,\n                source: Some(source),\n                registry,\n                rename,\n            };\n            Ok(dep)\n        } else {\n            anyhow::bail!(\"Unrecognized` dependency entry format for `{key}\");\n        }\n    }\n\n    /// Get the dependency name as defined in the manifest,\n    /// that is, either the alias (rename field if Some),\n    /// or the official package name (name field).\n    pub fn toml_key(&self) -> &str {\n        self.rename().unwrap_or(&self.name)\n    }\n\n    /// Convert dependency to TOML.\n    ///\n    /// Returns a tuple with the dependency's name and either the version as a\n    /// `String` or the path/git repository as an `InlineTable`.\n    /// (If the dependency is set as `optional` or `default-features` is set to\n    /// `false`, an `InlineTable` is returned in any case.)\n    ///\n    /// # Panic","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/editor/dependency.rs#L362-L398","documentation":"Thrown by `Dependency::from_toml` (editor) at src/workspace/editor/dependency.rs:380 — the final `else` branch of the parser. It fires when the TOML value for a dependency key is neither a plain version string nor a table-like item (e.g. it is an integer, float, bool, array, or datetime). A dependency must be `name = \"version\"` or `name = { ... }`.","triggerScenarios":"Entries such as `foo = 1` (bare integer), `foo = true`, `foo = [\"1.0\"]`, or `foo = 1.0`. The `if let Some(version) = item.as_str()` and `else if let Some(table) = item.as_table_like()` branches both fail, dropping into the catch-all.","commonSituations":"Omitting quotes around a version (`foo = 1.0` instead of `foo = \"1.0\"`); malformed YAML-to-TOML conversion; LLM-generated manifests.","solutions":["Quote the version: `foo = \"1.0\"`.","If you need options, use a table: `foo = { version = \"1.0\", optional = true }`.","Validate the manifest with `toml-edit`/`cargo check` after editing to catch the type mismatch early."],"exampleFix":"# before\nfoo = 1.0\n# after\nfoo = \"1.0\"","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn is_valid_dep_item(item: &toml_edit::Item) -> bool {\n    item.as_str().is_some() || item.as_table_like().is_some()\n}\n// assert is_valid_dep_item(&doc[\"dependencies\"][\"foo\"]) before parsing","tryCatchPattern":null,"preventionTips":["Dependency values must be a quoted string or a table — never a bare number/bool/array.","Run `cargo check` after generating manifests from scripts/templates.","Quote all version literals."],"tags":["manifest","dependencies","toml"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}