{"record":{"id":"13f0b0592fe9c930","repo":"tauri-apps/tauri","slug":"failed-to-bundle-app-with-makensis","errorCode":null,"errorMessage":"Failed to bundle app with makensis","messagePattern":"Failed to bundle app with makensis","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-bundler/src/bundle/windows/nsis/mod.rs","lineNumber":712,"sourceCode":"  let status = nsis_cmd\n    .args([\"-INPUTCHARSET\", \"UTF8\", \"-OUTPUTCHARSET\", \"UTF8\"])\n    .arg(match settings.log_level() {\n      log::Level::Error => \"-V1\",\n      log::Level::Warn => \"-V2\",\n      log::Level::Info => \"-V3\",\n      _ => \"-V4\",\n    })\n    .arg(installer_nsi_path)\n    .env_remove(\"NSISDIR\")\n    .env_remove(\"NSISCONFDIR\")\n    .current_dir(output_path)\n    .piped()\n    .map_err(|error| Error::CommandFailed {\n      command: \"makensis.exe\".to_string(),\n      error,\n    })?;\n  if !status.success() {\n    bail!(\"Failed to bundle app with makensis\");\n  }\n\n  fs::rename(nsis_output_path, &nsis_installer_path)?;\n\n  if settings.windows().can_sign() {\n    try_sign(&nsis_installer_path, settings)?;\n  } else {\n    #[cfg(not(target_os = \"windows\"))]\n    log::warn!(\n      \"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...\"\n    );\n  }\n\n  Ok(vec![nsis_installer_path])\n}\n\nfn handlebars_or(\n  h: &handlebars::Helper<'_>,","sourceCodeStart":694,"sourceCodeEnd":730,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs#L694-L730","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run `tauri build` and read the makensis stderr/NSIS output printed above the error for the real failure","Validate any custom NSIS template or installerHooks scripts for syntax errors","Delete stale files in target/release/bundle/nsis and rebuild","Ensure the bundled makensis.exe (downloaded by tauri-cli) is used, not an old system-installed one"],"exampleFix":"// before (custom hook referencing a missing file)\n!insertmacro customInstall  ; typo: File \"missing.dll\"\n// after\nFile \"${BUILD_RESOURCES_DIR}\\\\missing.dll\"","handlingStrategy":"try-catch","validationCode":"// run first: `where makensis` / ensure NSIS target assets exist\nconst cfg = JSON.parse(fs.readFileSync('src-tauri/tauri.conf.json','utf8'));\nif ((cfg.bundle.targets ?? []).includes('nsis') && cfg.bundle.windows?.nsis?.template && !fs.existsSync(cfg.bundle.windows.nsis.template)) {\n  throw new Error('Custom NSIS template missing');\n}","typeGuard":"const isCommandFailed = (e: unknown): e is {command: string; error: unknown} =>\n  typeof e === 'object' && e !== null && 'command' in e && (e as any).command === 'makensis.exe';","tryCatchPattern":"try {\n  await build();\n} catch (e) {\n  if (isCommandFailed(e)) {\n    console.error('makensis failed; inspect NSIS stderr above, clean target/release/bundle/nsis and retry');\n  }\n  throw e;\n}","preventionTips":["Keep custom NSIS templates and hook scripts minimal and syntax-checked","Never edit files under target/release/bundle while a build runs","Let tauri-cli provision makensis instead of relying on a system copy","Add antivirus exclusions for target/ on Windows"],"tags":["windows","nsis","installer","bundler"],"backgroundTag":"http-error-response","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}