{"record":{"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":null,"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/eb98b54bc9f3c74519f43d066cb3fd02ebc88df0/src/workspace/editor/dependency.rs#L300-L336","documentation":"Thrown by the manifest editor dependency parser when a dependency table contains a 'workspace' key set to false. The editor only treats workspace = true as meaningful (it enables workspace dependency inheritance); explicitly writing workspace = false is rejected because it carries no information beyond the default and signals user confusion. This is distinct from the parser path which handles inheritance differently.","triggerScenarios":"Calling Dependency::from_toml (editor path) on a TOML dependency table whose 'workspace' key is the boolean false. This commonly happens when a tool or user generates a manifest with an explicit 'workspace = false' to 'disable' inheritance.","commonSituations":"A developer hand-edits Cargo.toml and adds workspace = false thinking it opts out of a workspace dependency. Automated migration tools that emit workspace = false for non-inherited deps. Copy-paste from a workspace-inheriting dep where the user changed true to false instead of deleting the key.","solutions":["Remove the 'workspace = false' line from the dependency entry entirely — non-inheritance is the default.","If you intended to inherit from the workspace, set workspace = true (and ensure the workspace root defines the dependency).","If you intended a standalone dependency, provide a version/path/git instead of the workspace key."],"exampleFix":"# before\n[dependencies]\nserde = { workspace = false }\n\n# after\n[dependencies]\nserde = \"1.0\"","handlingStrategy":"validation","validationCode":"fn dependency_workspace_key_is_valid(table: &toml_edit::Item) -> Result<(), String> {\n    if let Some(t) = table.as_table_like() {\n        if let Some(w) = t.get(\"workspace\").and_then(|v| v.as_bool()) {\n            if !w { return Err(\"remove `workspace = false`; it is unsupported\".into()); }\n        }\n    }\n    Ok(())\n}\n// run before Dependency::from_toml","typeGuard":"fn is_valid_workspace_decl(table: &toml_edit::Item) -> bool {\n    table.as_table_like()\n        .and_then(|t| t.get(\"workspace\").and_then(|v| v.as_bool()))\n        .map(|b| b) // true is fine, false is invalid\n        .unwrap_or(true)\n}","tryCatchPattern":"match Dependency::from_toml(key, item, ...) {\n    Ok(d) => d,\n    Err(e) if e.to_string().contains(\"workspace = false`) is unsupported\") => {\n        // strip the workspace=false key and retry\n        eprintln!(\"Remove the `workspace = false` line from dependency `{key}`\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Never emit `workspace = false`; omit the key for non-inherited deps.","Lint manifests in CI for explicit `workspace = false` entries.","When migrating from workspace inheritance, delete the key rather than flipping it to false."],"tags":["cargo","manifest","dependencies","workspace","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"}