{"record":{"id":"0cacd4b666ef9218","repo":"tauri-apps/tauri","slug":"cargo-manifest-must-have-the-package-version-fie","errorCode":null,"errorMessage":"Cargo manifest must have the `package.version` field","messagePattern":"Cargo manifest must have the `package\\.version` field","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/interface/rust.rs","lineNumber":1077,"sourceCode":"      Some(package_info) => package_info.clone(),\n      None => {\n        return Err(crate::Error::GenericError(\n          \"No package info in the config file\".to_owned(),\n        ))\n      }\n    };\n\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()","sourceCodeStart":1059,"sourceCodeEnd":1095,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/interface/rust.rs#L1059-L1095","documentation":"When deriving app metadata for build/bundle, the CLI falls back to the Cargo [package] version only when tauri.conf.json has no `version`. This expect fires when the crate's Cargo.toml has no `version` key at all under [package] (and no `version.workspace = true` inheritance), so there is no value to fall back to.","triggerScenarios":"Running `tauri build` / `tauri dev` / bundling while tauri.conf.json omits `version` and src-tauri/Cargo.toml's [package] section is missing the `version` field (for example deleted accidentally, or a hand-written manifest that cargo itself would also reject).","commonSituations":"Refactoring a workspace and dropping the version line; converting a crate to a workspace member incorrectly (removing version instead of switching to version.workspace = true); config split across files where the version ended up only in the workspace root but the app crate does not inherit it.","solutions":["Add `version = \"0.1.0\"` (or your real version) to [package] in src-tauri/Cargo.toml.","Or set `\"version\": \"1.0.0\"` in tauri.conf.json, which takes precedence over Cargo.","Or use workspace inheritance: `version.workspace = true` in the app crate plus a version under [workspace.package] in the workspace root (which leads to error 205 if the root lacks it).","Validate with `cargo metadata` or `cargo build` in src-tauri to confirm the manifest is well-formed."],"exampleFix":"# before: src-tauri/Cargo.toml\n[package]\nname = \"my-app\"\nedition = \"2021\"\n\n# after\n[package]\nname = \"my-app\"\nversion = \"0.1.0\"\nedition = \"2021\"","handlingStrategy":"validation","validationCode":"# Precheck: cargo can parse the manifest and a version is resolvable\ncd src-tauri && cargo metadata --no-deps --format-version 1 > /dev/null && \\\n  grep -qE '^\\s*version\\s*=' Cargo.toml || grep -q 'version.workspace' Cargo.toml || \\\n  { echo 'missing package.version'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep tauri.conf.json `version` or a Cargo [package] version set in every template you scaffold.","Run `cargo metadata` (or `cargo build`) as a fast lint in CI before tauri build.","When moving crates into a workspace, decide version strategy (literal vs workspace inheritance) explicitly."],"tags":["rust","tauri-cli","cargo","manifest","version"],"backgroundTag":"missing-manifest-field","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}