{"record":{"id":"87df3c4a70a03713","repo":"dbt-labs/dbt-core","slug":"no-workspace-table","errorCode":null,"errorMessage":"no `[workspace]` table","messagePattern":"no `\\[workspace\\]` table","errorType":"exception","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"crates/dbt-ci/src/bump_cargo_version.rs","lineNumber":60,"sourceCode":"                // Version write already succeeded; lockfile refresh is best-effort.\n                eprintln!(\n                    \"warning: `cargo update --workspace --offline` failed. \\\n                     Version edits are applied; rerun lockfile refresh manually.\"\n                );\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,","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-ci/src/bump_cargo_version.rs#L42-L78","documentation":"`write_workspace_version` in crates/dbt-ci/src/bump_cargo_version.rs parses a Cargo.toml with toml_edit and requires a `[workspace]` table to update the workspace package version. If the file parses as valid TOML but contains no `[workspace]` section, the lookup of the `workspace` key returns None and the function bails with this error. It guards against running the version-bump tool against a non-workspace manifest.","triggerScenarios":"Running the version bump command with a path to a Cargo.toml that has no `[workspace]` table — e.g. a plain single-package manifest, a `[workspace]` misspelled as `[workspaces]`, or the wrong file passed via the path argument.","commonSituations":"Pointing the bump tool at a member crate's Cargo.toml instead of the workspace root; migrating a repo from standalone-package layout to a workspace and forgetting to add the `[workspace]` table; a typo in the table header.","solutions":["Ensure the target Cargo.toml contains a `[workspace]` table (add one with at least `members = [...]` if converting to a workspace).","Run the tool against the workspace-root Cargo.toml, not a member crate manifest.","Check for typos in the table header (`[workspace]`, not `[workspaces]` or nesting under another table)."],"exampleFix":"// before (Cargo.toml)\n[package]\nname = \"my-crate\"\nversion = \"0.1.0\"\n// after\n[workspace]\nmembers = [\"crates/*\"]\n\n[workspace.package]\nversion = \"0.1.0\"\n\n[package]\nname = \"my-crate\"\nversion.workspace = true","handlingStrategy":"validation","validationCode":"let src = std::fs::read_to_string(&path)?;\nlet doc: toml::Table = src.parse()?;\nif !doc.contains_key(\"workspace\") {\n    return Err(format!(\"{} has no [workspace] table\", path.display()));\n}","typeGuard":"fn is_workspace_manifest(doc: &toml::Value) -> bool {\n    doc.get(\"workspace\").and_then(|w| w.as_table()).is_some()\n}","tryCatchPattern":"if let Err(e) = bump_version(&root_cargo_toml) {\n    if e.to_string().contains(\"[workspace] table\") {\n        eprintln!(\"targeted the wrong Cargo.toml; use the workspace root\");\n    }\n}","preventionTips":["Run the bump tool against the workspace-root Cargo.toml only.","Add a CI assertion that the root manifest contains [workspace] and [workspace.package].","Keep workspace.package.version as the single source of truth for versions."],"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-14T11:17:12.474Z"}