tauri-apps/tauri · error

Failed to bundle app with makensis

Error message

Failed to bundle app with makensis

What it means

The NSIS installer build command (makensis.exe) exited with a non-success status, so tauri-bundler aborts the Windows NSIS bundling step with this generic message. The actual reason makensis failed is only available in the command's stderr output printed just before this bail. It is thrown in build_nsis_app_installer after spawning makensis and mapping spawn failures to Error::CommandFailed.

Solutions

  1. Re-run `tauri build` and read the makensis stderr/NSIS output printed above the error for the real failure
  2. Validate any custom NSIS template or installerHooks scripts for syntax errors
  3. Delete stale files in target/release/bundle/nsis and rebuild
  4. Ensure the bundled makensis.exe (downloaded by tauri-cli) is used, not an old system-installed one

Example fix

// before (custom hook referencing a missing file)
!insertmacro customInstall  ; typo: File "missing.dll"
// after
File "${BUILD_RESOURCES_DIR}\\missing.dll"
Defensive patterns

Strategy: try-catch

Validate before calling

// run first: `where makensis` / ensure NSIS target assets exist
const cfg = JSON.parse(fs.readFileSync('src-tauri/tauri.conf.json','utf8'));
if ((cfg.bundle.targets ?? []).includes('nsis') && cfg.bundle.windows?.nsis?.template && !fs.existsSync(cfg.bundle.windows.nsis.template)) {
  throw new Error('Custom NSIS template missing');
}

Type guard

const isCommandFailed = (e: unknown): e is {command: string; error: unknown} =>
  typeof e === 'object' && e !== null && 'command' in e && (e as any).command === 'makensis.exe';

Try / catch

try {
  await build();
} catch (e) {
  if (isCommandFailed(e)) {
    console.error('makensis failed; inspect NSIS stderr above, clean target/release/bundle/nsis and retry');
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `tauri build` on Windows with the NSIS bundle target enabled and makensis.exe exits non-zero — e.g. invalid NSIS template/installer hooks, corrupted or locked output path, bad installer icon, or an unsupported makensis version.

Common situations: Custom NSIS template files with syntax errors, user-defined hooks scripts referencing missing files, antivirus locking the installer during build, or PATH picking up an old/incompatible makensis.exe.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

Thrown at crates/tauri-bundler/src/bundle/windows/nsis/mod.rs:712

  let status = nsis_cmd
    .args(["-INPUTCHARSET", "UTF8", "-OUTPUTCHARSET", "UTF8"])
    .arg(match settings.log_level() {
      log::Level::Error => "-V1",
      log::Level::Warn => "-V2",
      log::Level::Info => "-V3",
      _ => "-V4",
    })
    .arg(installer_nsi_path)
    .env_remove("NSISDIR")
    .env_remove("NSISCONFDIR")
    .current_dir(output_path)
    .piped()
    .map_err(|error| Error::CommandFailed {
      command: "makensis.exe".to_string(),
      error,
    })?;
  if !status.success() {
    bail!("Failed to bundle app with makensis");
  }

  fs::rename(nsis_output_path, &nsis_installer_path)?;

  if settings.windows().can_sign() {
    try_sign(&nsis_installer_path, settings)?;
  } else {
    #[cfg(not(target_os = "windows"))]
    log::warn!(
      "Signing, by default, is only supported on Windows hosts, but you can specify a custom signing command in `bundler > windows > sign_command`, for now, skipping signing the installer..."
    );
  }

  Ok(vec![nsis_installer_path])
}

fn handlebars_or(
  h: &handlebars::Helper<'_>,

View on GitHub (pinned to 460ec35447)