denoland/deno · error

deno.json `version` "{version}" cannot be used as an MSI Pro

Error message

deno.json `version` "{version}" cannot be used as an MSI ProductVersion: the {name} field {field} exceeds the maximum of {limit}. Windows Installer packs ProductVersion into major(0-255).minor(0-255).build(0-65535), so a CalVer-style version has no valid encoding. Either use a version within those bounds, or build a non-MSI format (.deb/.rpm/.appimage/.app carry the version verbatim).

What it means

This error is thrown when the deno.json `version` cannot be encoded as a Windows Installer MSI ProductVersion. MSI packs the version as major(0-255).minor(0-255).build(0-65535), so any field exceeding its limit — such as a CalVer-style year like `2026.8.26` — has no valid encoding. The tool reports this rather than silently mangling a version the user did not write.

Source

Thrown at cli/tools/desktop.rs:4494

    return Ok("1.0.0".to_string());
  };
  let Some(fields) = numeric_version_fields(version) else {
    // MSI's ProductVersion can't express a non-numeric version at all, so
    // the default is the only way through. `create_windows_msi` warns about
    // it; this stays a pure reduction so tests and the plist path can call
    // it without logging.
    return Ok("1.0.0".to_string());
  };
  // Windows Installer packs ProductVersion into 8/8/16 bits, so a field that
  // overflows either makes the package fail validation or, worse, silently
  // compares wrong against an installed build. Truncating would ship a
  // version the user didn't write, so a CalVer-style `2026.8.26` has to be
  // reported rather than mangled.
  const LIMITS: [(u64, &str); 3] =
    [(255, "major"), (255, "minor"), (65535, "build")];
  for (field, (limit, name)) in fields.iter().zip(LIMITS) {
    if *field > limit {
      bail!(
        "deno.json `version` \"{version}\" cannot be used as an MSI \
         ProductVersion: the {name} field {field} exceeds the maximum of \
         {limit}. Windows Installer packs ProductVersion into \
         major(0-255).minor(0-255).build(0-65535), so a CalVer-style version \
         has no valid encoding. Either use a version within those bounds, or \
         build a non-MSI format (.deb/.rpm/.appimage/.app carry the version \
         verbatim)."
      );
    }
  }
  Ok(
    fields
      .iter()
      .map(u64::to_string)
      .collect::<Vec<_>>()
      .join("."),
  )
}

View on GitHub (pinned to f7822238ca)

Solutions

  1. Use a version that fits within major<=255, minor<=255, build<=65535, e.g. "1.8.26" style.
  2. Build a non-MSI format (.deb/.rpm/.appimage/.app) which carries the version verbatim.
  3. Keep two version strings: a CalVer for metadata and an MSI-compatible semver for Windows builds.

Example fix

// deno.json
// before
{ "version": "2026.8.26" }  // major 2026 > 255, invalid for MSI
// after
{ "version": "1.8.26" }
Defensive patterns

Strategy: validation

Validate before calling

const [major = 0, minor = 0, build = 0] = config.version.split(".").map(Number);
if (major > 255 || minor > 255 || build > 65535) {
  throw new Error(`deno.json version "${config.version}" cannot be encoded as MSI ProductVersion (major<=255, minor<=255, build<=65535)`);
}

Type guard

function isMsiCompatibleVersion(version: string): boolean {
  const [maj, min, bld] = version.split(".").map(Number);
  return maj <= 255 && min <= 255 && bld <= 65535;
}

Try / catch

try {
  await buildDesktopApp({ format: "msi" });
} catch (err) {
  if (String(err.message).includes("MSI ProductVersion")) {
    console.error("Use a version within major<=255.minor<=255.build<=65535, or build .deb/.rpm/.appimage/.app instead.");
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Setting a deno.json `version` whose major or minor component exceeds 255, or whose build/patch component exceeds 65535, and building an MSI target — most commonly a CalVer date-based version like "2026.8.26".

Common situations: Using calendar versions (year.month.day) in deno.json; using very large version numbers; a project that recently switched from semver to CalVer and then enabled MSI desktop packaging.

Related errors


AI-assisted analysis of denoland/deno@f7822238ca (2026-08-29). Data as JSON: /api/errors/05a4aa9c59286830. Report an issue: GitHub.