{"id":"616d7d0d359f343e","repo":"rust-lang/cargo","slug":"dependency-name-in-toml-specified-without-prov","errorCode":null,"errorMessage":"dependency ({name_in_toml}) 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":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/parser/mod.rs","lineNumber":2234,"sourceCode":"    dep_to_dependency(config_patch, name, manifest_ctx, None)\n}\n\nfn dep_to_dependency<P: ResolveToPath + Clone>(\n    orig: &manifest::TomlDependency<P>,\n    name_in_toml: &str,\n    manifest_ctx: &mut ManifestContext<'_, '_>,\n    kind: Option<DepKind>,\n) -> CargoResult<Dependency> {\n    let orig = match orig {\n        manifest::TomlDependency::Simple(version) => &manifest::TomlDetailedDependency::<P> {\n            version: Some(version.clone()),\n            ..Default::default()\n        },\n        manifest::TomlDependency::Detailed(details) => details,\n    };\n\n    if orig.version.is_none() && orig.path.is_none() && orig.git.is_none() {\n        anyhow::bail!(\n            \"dependency ({name_in_toml}) specified without \\\n                 providing a local path, Git repository, version, or \\\n                 workspace dependency to use\"\n        );\n    }\n\n    if let Some(version) = &orig.version {\n        if version.contains('+') {\n            manifest_ctx.warnings.push(format!(\n                \"version requirement `{}` for dependency `{}` \\\n                     includes semver metadata which will be ignored, removing the \\\n                     metadata is recommended to avoid confusion\",\n                version, name_in_toml\n            ));\n        }\n    }\n\n    if orig.git.is_none() {","sourceCodeStart":2216,"sourceCodeEnd":2252,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/parser/mod.rs#L2216-L2252","documentation":"Thrown by `dep_to_dependency` at src/workspace/parser/mod.rs:2234, the main manifest parser's counterpart of the editor's error 202. When a dependency's detailed table has none of `version`, `path`, or `git` (and it is not a workspace-inherited dependency, since those are resolved earlier), cargo cannot determine the source and bails. The message also mentions the workspace option for discoverability.","triggerScenarios":"A `[dependencies]` entry like `foo = { optional = true }`, `foo = { features = [\"a\"] }`, or `foo = { registry = \"myreg\" }` with no version/path/git, in a normal (non-workspace-inherited) dependency.","commonSituations":"Partial manifest edits; depending on a renamed package and dropping the version; migration scripts that strip fields.","solutions":["Add a source: `foo = { version = \"1.0\", optional = true }`, or `path`, or `git`.","To inherit, set `workspace = true` and define the dep under `[workspace.dependencies]`.","Re-generate the entry with `cargo add foo`."],"exampleFix":"# before\n[dependencies]\nfoo = { optional = true }\n# after\n[dependencies]\nfoo = { version = \"1.0\", optional = true }","handlingStrategy":"validation","validationCode":"for (k, item) in deps {\n    if let Some(t) = item.as_table_like() {\n        let has_source = [\"version\",\"path\",\"git\"].iter().any(|s| t.contains_key(s))\n            || t.get(\"workspace\").and_then(|v| v.as_bool()) == Some(true);\n        if !has_source { return Err(format!(\"dep {k} has no source\")); }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Every dependency needs version/path/git or workspace inheritance.","Validate manifests with a schema/toml check in CI.","Use `cargo add` to author dependency entries."],"tags":["manifest","dependencies","parser"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}