{"record":{"id":"07cc8a9659c48a31","repo":"rust-lang/cargo","slug":"dependency-key-specified-without-providing-a-l","errorCode":null,"errorMessage":"dependency ({key}) specified without providing a local path, Git repository, version, or workspace dependency to use","messagePattern":"dependency \\((.+?)\\) specified without providing a local path, Git repository, version, or workspace dependency to use","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/workspace/editor/dependency.rs","lineNumber":323,"sourceCode":"                        })?);\n                    }\n                    src.into()\n                } else if let Some(version) = table.get(\"version\") {\n                    let src = RegistrySource::new(version.as_str().ok_or_else(|| {\n                        invalid_type(key, \"version\", version.type_name(), \"string\")\n                    })?);\n                    src.into()\n                } else if let Some(workspace) = table.get(\"workspace\") {\n                    let workspace_bool = workspace.as_bool().ok_or_else(|| {\n                        invalid_type(key, \"workspace\", workspace.type_name(), \"bool\")\n                    })?;\n                    if !workspace_bool {\n                        anyhow::bail!(\"`{key}.workspace = false` is unsupported\")\n                    }\n                    let src = WorkspaceSource::new();\n                    src.into()\n                } else {\n                    anyhow::bail!(\n                        \"dependency ({key}) specified without \\\n                        providing a local path, Git repository, version, or \\\n                        workspace dependency to use\"\n                    );\n                };\n            let registry = if let Some(value) = table.get(\"registry\") {\n                Some(\n                    value\n                        .as_str()\n                        .ok_or_else(|| invalid_type(key, \"registry\", value.type_name(), \"string\"))?\n                        .to_owned(),\n                )\n            } else {\n                None\n            };\n\n            let default_features = table.get(\"default-features\").and_then(|v| v.as_bool());\n            if table.contains_key(\"default_features\") {","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/rust-lang/cargo/blob/eb98b54bc9f3c74519f43d066cb3fd02ebc88df0/src/workspace/editor/dependency.rs#L305-L341","documentation":"Thrown by the manifest editor dependency parser when a dependency entry is a table but contains none of the recognized source keys: 'git', 'path', 'version', or 'workspace'. The parser falls through all source-detection branches and hits the final else. It means the dependency was declared as a table yet has no way to locate its code.","triggerScenarios":"Calling Dependency::from_toml on a TOML table like { optional = true } or { features = [\"derive\"] } that omits every source key. The editor tries git, then path, then version, then workspace, then bails.","commonSituations":"A developer writes [dependencies.serde] with only feature/optional flags and forgets the version. A migration tool strips a version field while preserving the table shape. Typos like 'verison' instead of 'version' leave no recognized source.","solutions":["Add a 'version' key to the dependency table (e.g. version = \"1.0\").","Alternatively add 'path', 'git', or 'workspace = true' to identify the source.","Check for misspelled source keys (verison, pat, etc.) and correct them."],"exampleFix":"# before\n[dependencies]\nserde = { features = [\"derive\"] }\n\n# after\n[dependencies]\nserde = { version = \"1.0\", features = [\"derive\"] }","handlingStrategy":"validation","validationCode":"fn has_dependency_source(table: &toml_edit::Item) -> bool {\n    if let Some(t) = table.as_table_like() {\n        return t.contains_key(\"git\") || t.contains_key(\"path\")\n            || t.contains_key(\"version\") || t.contains_key(\"workspace\");\n    }\n    false\n}\n// assert before calling Dependency::from_toml","typeGuard":"fn is_complete_dependency_table(table: &dyn toml_edit::TableLike) -> bool {\n    [\"git\",\"path\",\"version\",\"workspace\"].iter().any(|k| table.contains_key(*k))\n}","tryCatchPattern":null,"preventionTips":["Require a version/path/git/workspace key in every dependency table before parsing.","Use a manifest linter (cargo-deny, taplo) to catch source-less dependencies.","When generating manifests programmatically, assert each dep has a source field."],"tags":["cargo","manifest","dependencies","missing-source","editor"],"backgroundTag":null,"analyzedSha":"eb98b54bc9f3c74519f43d066cb3fd02ebc88df0","analyzedAt":"2026-08-11T17:42:36.556Z","contentChangedAt":"2026-08-11T17:42:36.556Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}