{"record":{"id":"05a4aa9c59286830","repo":"denoland/deno","slug":"deno-json-version-version-cannot-be-used-as-05a4aa","errorCode":null,"errorMessage":"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).","messagePattern":"deno\\.json `version` \"(.+?)\" cannot be used as an MSI ProductVersion: the (.+?) field (.+?) exceeds the maximum of (.+?)\\. 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\\)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/desktop.rs","lineNumber":4494,"sourceCode":"    return Ok(\"1.0.0\".to_string());\n  };\n  let Some(fields) = numeric_version_fields(version) else {\n    // MSI's ProductVersion can't express a non-numeric version at all, so\n    // the default is the only way through. `create_windows_msi` warns about\n    // it; this stays a pure reduction so tests and the plist path can call\n    // it without logging.\n    return Ok(\"1.0.0\".to_string());\n  };\n  // Windows Installer packs ProductVersion into 8/8/16 bits, so a field that\n  // overflows either makes the package fail validation or, worse, silently\n  // compares wrong against an installed build. Truncating would ship a\n  // version the user didn't write, so a CalVer-style `2026.8.26` has to be\n  // reported rather than mangled.\n  const LIMITS: [(u64, &str); 3] =\n    [(255, \"major\"), (255, \"minor\"), (65535, \"build\")];\n  for (field, (limit, name)) in fields.iter().zip(LIMITS) {\n    if *field > limit {\n      bail!(\n        \"deno.json `version` \\\"{version}\\\" cannot be used as an MSI \\\n         ProductVersion: the {name} field {field} exceeds the maximum of \\\n         {limit}. Windows Installer packs ProductVersion into \\\n         major(0-255).minor(0-255).build(0-65535), so a CalVer-style version \\\n         has no valid encoding. Either use a version within those bounds, or \\\n         build a non-MSI format (.deb/.rpm/.appimage/.app carry the version \\\n         verbatim).\"\n      );\n    }\n  }\n  Ok(\n    fields\n      .iter()\n      .map(u64::to_string)\n      .collect::<Vec<_>>()\n      .join(\".\"),\n  )\n}","sourceCodeStart":4476,"sourceCodeEnd":4512,"githubUrl":"https://github.com/denoland/deno/blob/f7822238cab635a3a19f99f493f675fa81a7f9d8/cli/tools/desktop.rs#L4476-L4512","documentation":"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.","triggerScenarios":"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\".","commonSituations":"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.","solutions":["Use a version that fits within major<=255, minor<=255, build<=65535, e.g. \"1.8.26\" style.","Build a non-MSI format (.deb/.rpm/.appimage/.app) which carries the version verbatim.","Keep two version strings: a CalVer for metadata and an MSI-compatible semver for Windows builds."],"exampleFix":"// deno.json\n// before\n{ \"version\": \"2026.8.26\" }  // major 2026 > 255, invalid for MSI\n// after\n{ \"version\": \"1.8.26\" }","handlingStrategy":"validation","validationCode":"const [major = 0, minor = 0, build = 0] = config.version.split(\".\").map(Number);\nif (major > 255 || minor > 255 || build > 65535) {\n  throw new Error(`deno.json version \"${config.version}\" cannot be encoded as MSI ProductVersion (major<=255, minor<=255, build<=65535)`);\n}","typeGuard":"function isMsiCompatibleVersion(version: string): boolean {\n  const [maj, min, bld] = version.split(\".\").map(Number);\n  return maj <= 255 && min <= 255 && bld <= 65535;\n}","tryCatchPattern":"try {\n  await buildDesktopApp({ format: \"msi\" });\n} catch (err) {\n  if (String(err.message).includes(\"MSI ProductVersion\")) {\n    console.error(\"Use a version within major<=255.minor<=255.build<=65535, or build .deb/.rpm/.appimage/.app instead.\");\n  } else {\n    throw err;\n  }\n}","preventionTips":["Avoid CalVer (year-based) versions for MSI builds; they always exceed the major limit of 255.","Keep a separate semver-compatible version for Windows/MSI packaging.","Validate major<=255, minor<=255, build<=65535 in CI before MSI builds."],"tags":["cli","desktop","windows","msi","version-validation","packaging"],"backgroundTag":"msi-productversion-out-of-range","analyzedSha":"f7822238cab635a3a19f99f493f675fa81a7f9d8","analyzedAt":"2026-08-29T08:55:39.519Z","contentChangedAt":"2026-08-29T08:55:39.519Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}