{"id":"f0694d5f41c1071a","repo":"rust-lang/cargo","slug":"key-workspace-false-is-unsupported","errorCode":null,"errorMessage":"`{key}.workspace = false` is unsupported","messagePattern":"`(.+?)\\.workspace = false` is unsupported","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/editor/dependency.rs","lineNumber":318,"sourceCode":"                    let mut src = PathSource::new(path);\n                    src.base = base;\n                    if let Some(value) = table.get(\"version\") {\n                        src = src.set_version(value.as_str().ok_or_else(|| {\n                            invalid_type(key, \"version\", value.type_name(), \"string\")\n                        })?);\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 {","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/editor/dependency.rs#L300-L336","documentation":"Thrown by `Dependency::from_toml` (the editor used by `cargo add`/`cargo rm`) at src/workspace/editor/dependency.rs:318. When a dependency table contains a `workspace` key whose value is `false`, cargo rejects it because `workspace = false` is semantically a no-op — the absence of the key already means \"do not inherit from workspace.dependencies\". Only the positive `workspace = true` form is meaningful.","triggerScenarios":"A `[dependencies]` entry written as `foo = { workspace = false }`, or `cargo add` leaving behind `{ workspace = false }` in a member Cargo.toml. The branch is reached only when the table has no `git`/`path`/`version` and `table.get(\"workspace\")` yields a bool `false`.","commonSituations":"Hand-editing a manifest after removing workspace inheritance; tools/generators that emit `workspace = false` defensively; misunderstanding that `false` must be expressed by omitting the key.","solutions":["Delete the `workspace = false` pair so the line becomes `foo = \"1.0\"` (or whatever the real source is).","If you intended inheritance, change it to `foo = { workspace = true }` and define `foo` under `[workspace.dependencies]` in the workspace root."],"exampleFix":"# before\nfoo = { workspace = false }\n# after\nfoo = \"1.0\"\n# (or, to inherit)\nfoo = { workspace = true }","handlingStrategy":"validation","validationCode":"// before invoking the manifest editor, scrub `workspace = false`\nfor (_k, item) in doc.as_table().iter() {\n    if let Some(t) = item.as_table_like() {\n        if matches!(t.get(\"workspace\").and_then(|v| v.as_bool()), Some(false)) {\n            // remove or convert before calling Dependency::from_toml\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat `workspace = false` as always redundant — never write it.","Use `cargo add`/`cargo rm` instead of hand-editing dependency tables.","Lint manifests in CI for `workspace = false` occurrences."],"tags":["manifest","dependencies","workspace"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}