DioxusLabs/dioxus · error · anyhow::Error

Invalid version for MSI: '{}'. Expected format: major.minor.

Error message

Invalid version for MSI: '{}'. Expected format: major.minor.patch[.build]

What it means

Validation guard in wix_version (called from bundle_windows_msi): after stripping any pre-release segment from the crate's version string, splitting on '.' produced fewer than 2 or more than 4 components, which does not match the numeric major.minor[.patch][.build] layout WiX requires. The input at fault is the project's semver version string, whose dotted shape cannot be mapped onto an MSI ProductVersion.

Source

Thrown at packages/cli/src/bundler/windows.rs:937

    let safe_template = template.replace("\\{{", &replacement);
    let mut hbs = Handlebars::new();
    hbs.set_strict_mode(false);
    hbs.register_escape_fn(|s: &str| s.to_string());
    hbs.register_template_string("template", &safe_template)
        .context("Failed to parse template")?;
    let rendered = hbs
        .render("template", data)
        .context("Failed to render template")?;
    Ok(rendered.replace(BACKSLASH_PLACEHOLDER, "\\"))
}

/// Convert a semver version string to a WiX-compatible version.
fn wix_version(version: &str) -> Result<String> {
    let version = version.split('-').next().unwrap_or(version);
    let parts: Vec<&str> = version.split('.').collect();

    if parts.len() < 2 || parts.len() > 4 {
        bail!(
            "Invalid version for MSI: '{}'. Expected format: major.minor.patch[.build]",
            version
        );
    }

    for (i, part) in parts.iter().enumerate() {
        let num: u64 = part
            .parse()
            .with_context(|| format!("Invalid version component: '{part}'"))?;
        match i {
            0 | 1 if num > 255 => {
                bail!("Version component {part} exceeds maximum value of 255");
            }
            2 | 3 if num > 65535 => {
                bail!("Version component {part} exceeds maximum value of 65535");
            }
            _ => {}
        }

View on GitHub (pinned to 24f6a829df)

Solutions

  1. Use a numeric MSI version in the format major.minor.patch[.build] in Dioxus.toml.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cli/src/bundler/windows.rs:937 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/844d034f4b50250e. Report an issue: GitHub.