tauri-apps/tauri · error

Cargo project does not have a version

Error message

Cargo project does not have a version

What it means

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.

Source

Thrown at crates/tauri-cli/src/interface/rust.rs:1084

    let workspace_dir = get_workspace_dir(tauri_dir)?;
    let ws_package_settings = CargoSettings::load(&workspace_dir)
      .context("failed to load Cargo settings from workspace root")?
      .workspace
      .and_then(|v| v.package);

    let version = config.version.clone().unwrap_or_else(|| {
      cargo_package_settings
        .version
        .clone()
        .expect("Cargo manifest must have the `package.version` field")
        .resolve("version", || {
          ws_package_settings
            .as_ref()
            .and_then(|p| p.version.clone())
            .context("Couldn't inherit value for `version` from workspace")
        })
        .expect("Cargo project does not have a version")
    });

    let package_settings = PackageSettings {
      product_name: config
        .product_name
        .clone()
        .unwrap_or_else(|| cargo_package_settings.name.clone()),
      version,
      description: cargo_package_settings
        .description
        .clone()
        .map(|description| {
          description
            .resolve("description", || {
              ws_package_settings
                .as_ref()
                .and_then(|v| v.description.clone())
                .context("Couldn't inherit value for `description` from workspace")

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. 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`).
  2. Or drop inheritance and set a literal `version` in the app crate's [package].
  3. Or set `"version"` in tauri.conf.json, which bypasses the Cargo lookup entirely.
  4. Confirm the workspace resolves by running `cargo metadata --no-deps` at the workspace root.

Example fix

# before: root Cargo.toml
[workspace]
members = ["src-tauri"]

# after
[workspace]
members = ["src-tauri"]

[workspace.package]
version = "1.2.3"
Defensive patterns

Strategy: validation

Validate before calling

# Precheck workspace inheritance resolves before tauri build
cargo metadata --no-deps --format-version 1 2>/dev/null | \
  jq -e '.packages[] | select(.name=="my-app") | .version' || \
  { echo 'package.version not resolvable (check [workspace.package].version)'; exit 1; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/c590941ff7f960b9. Report an issue: GitHub.