{"record":{"id":"c590941ff7f960b9","repo":"tauri-apps/tauri","slug":"cargo-project-does-not-have-a-version","errorCode":null,"errorMessage":"Cargo project does not have a version","messagePattern":"Cargo project does not have a version","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/interface/rust.rs","lineNumber":1084,"sourceCode":"\n    let workspace_dir = get_workspace_dir(tauri_dir)?;\n    let ws_package_settings = CargoSettings::load(&workspace_dir)\n      .context(\"failed to load Cargo settings from workspace root\")?\n      .workspace\n      .and_then(|v| v.package);\n\n    let version = config.version.clone().unwrap_or_else(|| {\n      cargo_package_settings\n        .version\n        .clone()\n        .expect(\"Cargo manifest must have the `package.version` field\")\n        .resolve(\"version\", || {\n          ws_package_settings\n            .as_ref()\n            .and_then(|p| p.version.clone())\n            .context(\"Couldn't inherit value for `version` from workspace\")\n        })\n        .expect(\"Cargo project does not have a version\")\n    });\n\n    let package_settings = PackageSettings {\n      product_name: config\n        .product_name\n        .clone()\n        .unwrap_or_else(|| cargo_package_settings.name.clone()),\n      version,\n      description: cargo_package_settings\n        .description\n        .clone()\n        .map(|description| {\n          description\n            .resolve(\"description\", || {\n              ws_package_settings\n                .as_ref()\n                .and_then(|v| v.description.clone())\n                .context(\"Couldn't inherit value for `description` from workspace\")","sourceCodeStart":1066,"sourceCodeEnd":1102,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/interface/rust.rs#L1066-L1102","documentation":"If the app crate's Cargo.toml declares `version.workspace = true`, the CLI resolves the real value from [workspace.package] in the workspace root manifest. This expect fires when that resolve step fails: typically the workspace root Cargo.toml does not define a `version` under [workspace.package] (so inheritance has nothing to inherit), or the workspace package settings could not be loaded.","triggerScenarios":"Running `tauri build`/`tauri dev` with `version.workspace = true` in src-tauri/Cargo.toml while the workspace root Cargo.toml has no `[workspace.package]` section or no `version` key inside it, and tauri.conf.json also has no version.","commonSituations":"Adopting cargo workspace inheritance halfway: setting version.workspace = true in members but forgetting the [workspace.package] block; typos like [workspace.packages] (plural); workspace root manifest renamed so it is no longer found.","solutions":["Add `version = \"0.1.0\"` under `[workspace.package]` in the workspace root Cargo.toml (and `[workspace] package = [\"version\"]` is implied by the dotted path in modern cargo, but verify with `cargo metadata`).","Or drop inheritance and set a literal `version` in the app crate's [package].","Or set `\"version\"` in tauri.conf.json, which bypasses the Cargo lookup entirely.","Confirm the workspace resolves by running `cargo metadata --no-deps` at the workspace root."],"exampleFix":"# before: root Cargo.toml\n[workspace]\nmembers = [\"src-tauri\"]\n\n# after\n[workspace]\nmembers = [\"src-tauri\"]\n\n[workspace.package]\nversion = \"1.2.3\"","handlingStrategy":"validation","validationCode":"# Precheck workspace inheritance resolves before tauri build\ncargo metadata --no-deps --format-version 1 2>/dev/null | \\\n  jq -e '.packages[] | select(.name==\"my-app\") | .version' || \\\n  { echo 'package.version not resolvable (check [workspace.package].version)'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair `version.workspace = true` in members with a version under [workspace.package] at the root.","Test inheritance with `cargo metadata` in CI — it resolves exactly what tauri will read.","Consider setting version in tauri.conf.json for release automation so Cargo inheritance never gates builds."],"tags":["rust","cargo","workspace-inheritance","version","tauri-cli"],"backgroundTag":"workspace-inheritance-missing","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}