tauri-apps/tauri · error

Cargo manifest must have the `package.version` field

Error message

Cargo manifest must have the `package.version` field

What it means

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.

Source

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

      Some(package_info) => package_info.clone(),
      None => {
        return Err(crate::Error::GenericError(
          "No package info in the config file".to_owned(),
        ))
      }
    };

    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()

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Add `version = "0.1.0"` (or your real version) to [package] in src-tauri/Cargo.toml.
  2. Or set `"version": "1.0.0"` in tauri.conf.json, which takes precedence over Cargo.
  3. 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).
  4. Validate with `cargo metadata` or `cargo build` in src-tauri to confirm the manifest is well-formed.

Example fix

# before: src-tauri/Cargo.toml
[package]
name = "my-app"
edition = "2021"

# after
[package]
name = "my-app"
version = "0.1.0"
edition = "2021"
Defensive patterns

Strategy: validation

Validate before calling

# Precheck: cargo can parse the manifest and a version is resolvable
cd src-tauri && cargo metadata --no-deps --format-version 1 > /dev/null && \
  grep -qE '^\s*version\s*=' Cargo.toml || grep -q 'version.workspace' Cargo.toml || \
  { echo 'missing package.version'; exit 1; }

Prevention

When it happens

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

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

Related errors


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