rust-lang/cargo · error
` .workspace = false` is unsupported
Error message
`{key}.workspace = false` is unsupported What it means
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.
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.
Example fix
# before
[dependencies]
serde = { workspace = false }
# after
[dependencies]
serde = "1.0" Defensive patterns
Strategy: validation
Validate before calling
fn dependency_workspace_key_is_valid(table: &toml_edit::Item) -> Result<(), String> {
if let Some(t) = table.as_table_like() {
if let Some(w) = t.get("workspace").and_then(|v| v.as_bool()) {
if !w { return Err("remove `workspace = false`; it is unsupported".into()); }
}
}
Ok(())
}
// run before Dependency::from_toml Type guard
fn is_valid_workspace_decl(table: &toml_edit::Item) -> bool {
table.as_table_like()
.and_then(|t| t.get("workspace").and_then(|v| v.as_bool()))
.map(|b| b) // true is fine, false is invalid
.unwrap_or(true)
} Try / catch
match Dependency::from_toml(key, item, ...) {
Ok(d) => d,
Err(e) if e.to_string().contains("workspace = false`) is unsupported") => {
// strip the workspace=false key and retry
eprintln!("Remove the `workspace = false` line from dependency `{key}`");
return Err(e);
}
Err(e) => return Err(e),
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- dependency ( ) specified without providing a local path…
- Unrecognized` dependency entry format for
- Use of `default_features` in
- can only edit absolute paths, got
- cannot override `workspace.lints` in `lints`, either remove…
AI-assisted analysis of rust-lang/cargo@eb98b54bc9 (2026-08-11).
Data as JSON: /api/errors/f0694d5f41c1071a.
Report an issue: GitHub.
Appendix: source
Thrown at src/workspace/editor/dependency.rs:318
let mut src = PathSource::new(path);
src.base = base;
if let Some(value) = table.get("version") {
src = src.set_version(value.as_str().ok_or_else(|| {
invalid_type(key, "version", value.type_name(), "string")
})?);
}
src.into()
} else if let Some(version) = table.get("version") {
let src = RegistrySource::new(version.as_str().ok_or_else(|| {
invalid_type(key, "version", version.type_name(), "string")
})?);
src.into()
} else if let Some(workspace) = table.get("workspace") {
let workspace_bool = workspace.as_bool().ok_or_else(|| {
invalid_type(key, "workspace", workspace.type_name(), "bool")
})?;
if !workspace_bool {
anyhow::bail!("`{key}.workspace = false` is unsupported")
}
let src = WorkspaceSource::new();
src.into()
} else {
anyhow::bail!(
"dependency ({key}) specified without \
providing a local path, Git repository, version, or \
workspace dependency to use"
);
};
let registry = if let Some(value) = table.get("registry") {
Some(
value
.as_str()
.ok_or_else(|| invalid_type(key, "registry", value.type_name(), "string"))?
.to_owned(),
)
} else {View on GitHub (pinned to eb98b54bc9)