tauri-apps/tauri · error

optional build metadata in app version must be numeric-only…

Error message

optional build metadata in app version must be numeric-only and cannot be greater than 65535 for msi target

What it means

convert_version in the WiX MSI bundler converts the semver app version to a numeric-only MSI version. If the version has no numeric 4th field but does carry build metadata (the part after '+'), it can only be used if it parses as a number ≤ 65535; otherwise the bundler bails. MSI versions must be purely numeric, so non-numeric or oversized build metadata is rejected.

Solutions

  1. Remove the build metadata (the '+' part) from the app version when targeting msi
  2. Use numeric-only build metadata ≤ 65535, e.g. "1.2.3+42"
  3. Strip/normalize the version in CI before invoking tauri build for Windows

Example fix

// before (tauri.conf.json)
"version": "1.2.3+build.42"
// after
"version": "1.2.3"
Defensive patterns

Strategy: validation

Validate before calling

fn msi_build_meta_ok(v: &str) -> bool {
  match v.split_once('+') {
    None => true,
    Some((_, meta)) => meta.parse::<u64>().map(|n| n <= 65535).unwrap_or(false),
  }
}

Try / catch

match bundle_msi(cfg) {
  Err(e) if e.to_string().contains("build metadata") => eprintln!("strip '+' metadata from version"),
  Err(e) => eprintln!("bundling failed: {e}"),
  Ok(_) => {},
}

Prevention

When it happens

Trigger: Bundling an msi with a semver version containing build metadata that is non-numeric or greater than 65535 — e.g. "1.2.3+abc" or "1.2.3+70000" — via build_wix_app_installer.

Common situations: Versions like "1.2.3+build.42" produced by release tooling; CI injecting a commit hash or timestamp as build metadata; Cargo/semver versions with '+' metadata carried into Windows bundling.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18). Data as JSON: /api/errors/dfe1ee4a82279f2b. Report an issue: GitHub.

Appendix: source

Thrown at crates/tauri-bundler/src/bundle/windows/msi/mod.rs:354

  }

  Ok(())
}

// WiX requires versions to be numeric only in a `major.minor.patch.build` format
fn convert_version(version_str: &str) -> crate::Result<String> {
  let version = semver::Version::parse(version_str)
    .map_err(Into::into)
    .context("invalid app version")?;
  if !version.build.is_empty() {
    let build = version.build.parse::<u64>();
    if build.map(|b| b <= 65535).unwrap_or_default() {
      return Ok(format!(
        "{}.{}.{}.{}",
        version.major, version.minor, version.patch, version.build
      ));
    } else {
      crate::error::bail!(
        "optional build metadata in app version must be numeric-only and cannot be greater than 65535 for msi target"
      );
    }
  }

  if !version.pre.is_empty() {
    let pre = version.pre.parse::<u64>();
    if pre.is_ok() && pre.unwrap() <= 65535 {
      return Ok(format!(
        "{}.{}.{}.{}",
        version.major, version.minor, version.patch, version.pre
      ));
    } else {
      crate::error::bail!(
        "optional pre-release identifier in app version must be numeric-only and cannot be greater than 65535 for msi target"
      );
    }
  }

View on GitHub (pinned to 460ec35447)