{"record":{"id":"96d5f1debcca057b","repo":"dbt-labs/dbt-core","slug":"no-workspace-package-table","errorCode":null,"errorMessage":"no `[workspace.package]` table","messagePattern":"no `\\[workspace\\.package\\]` table","errorType":"exception","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"crates/dbt-ci/src/bump_cargo_version.rs","lineNumber":64,"sourceCode":"                );\n            }\n        }\n    }\n\n    ExitCode::SUCCESS\n}\n\nfn write_workspace_version(path: &Path, new_value: &str) -> Result<()> {\n    let src = fs::read_to_string(path).with_context(|| format!(\"read {}\", path.display()))?;\n    let mut doc: DocumentMut = src.parse().context(\"parse Cargo.toml\")?;\n    let workspace = doc\n        .get_mut(\"workspace\")\n        .and_then(|w| w.as_table_like_mut())\n        .ok_or_else(|| anyhow!(\"no `[workspace]` table\"))?;\n    let package = workspace\n        .get_mut(\"package\")\n        .and_then(|p| p.as_table_like_mut())\n        .ok_or_else(|| anyhow!(\"no `[workspace.package]` table\"))?;\n    package.insert(\"version\", value(new_value));\n    fs::write(path, doc.to_string()).with_context(|| format!(\"write {}\", path.display()))\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn write_workspace_version_overwrites_existing() {\n        let tmp = tempfile::tempdir().unwrap();\n        let path = tmp.path().join(\"Cargo.toml\");\n        fs::write(\n            &path,\n            r#\"[workspace.package]\nedition = \"2024\"\nversion = \"2.0.0-preview-nightly.176\"\nauthors = [\"dbt Labs\"]","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-ci/src/bump_cargo_version.rs#L46-L82","documentation":"`write_workspace_version` in crates/dbt-ci/src/bump_cargo_version.rs found a `[workspace]` table but no `[workspace.package]` table inside it. Since the version bump writes to `workspace.package.version`, the absence of the inner `package` table causes this bail. It indicates a partially converted or non-standard workspace manifest.","triggerScenarios":"The Cargo.toml has a `[workspace]` table (with members, dependencies, etc.) but defines no `[workspace.package]` section, so `workspace.get_mut(\"package\")` returns None. Also triggered when `package` exists but as a non-table value (e.g. a stray string).","commonSituations":"A workspace that pins versions per-crate instead of using `version.workspace = true` inheritance; a repo mid-migration to workspace-inherited versions; `[workspace.package]` header typoed or accidentally nested under another table.","solutions":["Add a `[workspace.package]` table containing `version = \"x.y.z\"` to the workspace-root Cargo.toml.","Switch member crates to inherit: `version.workspace = true` under `[package]`.","Verify the `[workspace.package]` header is at top level, not indented under another table (it must not be inside an array-of-tables or sub-table)."],"exampleFix":"// before (Cargo.toml)\n[workspace]\nmembers = [\"crates/*\"]\n// after\n[workspace]\nmembers = [\"crates/*\"]\n\n[workspace.package]\nversion = \"1.2.3\"","handlingStrategy":"validation","validationCode":"let doc: toml::Table = std::fs::read_to_string(&path)?.parse()?;\nlet has_ws_pkg = doc.get(\"workspace\")\n    .and_then(|w| w.get(\"package\"))\n    .and_then(|p| p.as_table())\n    .map(|t| t.contains_key(\"version\"))\n    .unwrap_or(false);\nif !has_ws_pkg {\n    return Err(format!(\"{} has no [workspace.package] version\", path.display()));\n}","typeGuard":"fn has_workspace_package(doc: &toml::Value) -> bool {\n    doc.get(\"workspace\")\n        .and_then(|w| w.get(\"package\"))\n        .and_then(|p| p.as_table())\n        .is_some()\n}","tryCatchPattern":"if let Err(e) = bump_version(&root_cargo_toml) {\n    if e.to_string().contains(\"[workspace.package] table\") {\n        eprintln!(\"add [workspace.package] with a version key first\");\n    }\n}","preventionTips":["Always define [workspace.package] version when creating a workspace.","Migrate member crates to version.workspace = true so inheritance stays consistent.","Lint the root manifest for [workspace.package].version in CI."],"tags":["cargo","toml","workspace","versioning"],"backgroundTag":"missing-required-config-field","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}