{"record":{"id":"7de1fd0ac13205d9","repo":"tauri-apps/tauri","slug":"failed-to-read-external-binary-path","errorCode":null,"errorMessage":"failed to read external binary path","messagePattern":"failed to read external binary path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-bundler/src/bundle/windows/msi/mod.rs","lineNumber":940,"sourceCode":"  let cwd = std::env::current_dir()?;\n  let tmp_dir = std::env::temp_dir();\n  for src in settings.external_binaries() {\n    let src = src?;\n    let binary_path = cwd.join(&src);\n    let dest_filename = src\n      .file_name()\n      .expect(\"failed to extract external binary filename\")\n      .to_string_lossy()\n      .replace(&format!(\"-{}\", settings.target()), \"\");\n    let dest = tmp_dir.join(&dest_filename);\n    std::fs::copy(binary_path, &dest)?;\n\n    binaries.push(Binary {\n      guid: Uuid::new_v4().to_string(),\n      path: dest\n        .into_os_string()\n        .into_string()\n        .expect(\"failed to read external binary path\"),\n      id: wix_identifier(&dest_filename),\n    });\n  }\n\n  for bin in settings.binaries() {\n    if !bin.main() {\n      binaries.push(Binary {\n        guid: Uuid::new_v4().to_string(),\n        path: settings\n          .binary_path(bin)\n          .into_os_string()\n          .into_string()\n          .expect(\"failed to read binary path\"),\n        id: wix_identifier(bin.name()),\n      })\n    }\n  }\n","sourceCodeStart":922,"sourceCodeEnd":958,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-bundler/src/bundle/windows/msi/mod.rs#L922-L958","documentation":"After copying an external binary to the temp directory, the MSI bundler converts the destination path to a UTF-8 String for the WiX data. into_string() fails when the OsString is not valid UTF-8 — i.e. the temp-directory path contains non-UTF-8 bytes (unpaired surrogates in a Windows user name, or a non-UTF-8 TMPDIR on Unix cross-builds).","triggerScenarios":"MSI bundling on a machine whose TMP/TEMP path is not representable as UTF-8: a Windows account name containing unpaired surrogates, or a Unix build container with non-UTF-8 bytes in TMPDIR — hit only when bundle.externalBin is non-empty.","commonSituations":"Windows usernames with rare or legacy Unicode; systems where TMP is redirected to an oddly encoded path; cross-compilation containers that inherit a binary-unsafe TMPDIR.","solutions":["Point TMP/TEMP at an ASCII path for the build: set TMP=C:\\tmp && set TEMP=C:\\tmp && tauri build --bundles msi","Build from an account with a plain-ASCII user name, or redirect the temp directory per-process","On Unix cross-builds, export TMPDIR=/tmp explicitly before invoking the bundler"],"exampleFix":":: before\ntauri build --bundles msi\n\n:: after (Windows cmd)\nset TMP=C:\\tmp\nset TEMP=C:\\tmp\ntauri build --bundles msi","handlingStrategy":"validation","validationCode":"// fail fast when TMP is not UTF-8 representable before MSI bundling with sidecars\nif let Err(_) = std::env::temp_dir().into_os_string().into_string() {\n  eprintln!(\"TMP path is not valid UTF-8; set TMP/TEMP to an ASCII directory before bundling\");\n  std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use ASCII paths for TMP/TEMP and project directories on Windows build machines","Avoid user accounts with legacy or surrogate Unicode names for builds","Set TMPDIR explicitly in cross-build containers"],"tags":["windows","msi","sidecar","utf-8","temp-dir","tauri-bundler"],"backgroundTag":"non-utf8-path","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}