{"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":944,"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":926,"sourceCodeEnd":962,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-bundler/src/bundle/windows/msi/mod.rs#L926-L962","documentation":"After copying an external binary into the temp dir, generate_binaries_data converts the destination OsString into a String via into_string().expect(\"failed to read external binary path\"). into_string() fails only when the path contains non-UTF-8 bytes, so the panic means the temp path to the binary is not valid UTF-8.","triggerScenarios":"Calling bundle_project when the temp directory path (std::env::temp_dir(), often TMP/TEMP) contains non-UTF-8 characters — e.g. a Windows username or TMP variable with accented/CJK characters in a non-UTF-8 codepage.","commonSituations":"Windows CI machines or developer accounts where %TEMP% resolves under a user profile with non-ASCII characters (é, ñ, Chinese characters) while the system uses a legacy codepage.","solutions":["Set TMP/TEMP to a simple ASCII path (e.g. C:\\tmp) before building.","If controlled by config, keep project/user paths ASCII; rename the Windows account or use a dedicated build user.","Patch the expect into a proper error (into_string().map_err(...)? ) so the failure is reported instead of panicking."],"exampleFix":"// before\npath: dest.into_os_string().into_string().expect(\"failed to read external binary path\"),\n\n// after\npath: dest.to_string_lossy().into_owned(),","handlingStrategy":"validation","validationCode":"// ensure the temp dir is ASCII/UTF-8 before bundling\nlet tmp = std::env::temp_dir();\nlet s = tmp.to_string_lossy();\nif s != tmp.to_str().unwrap_or(\"\\u{0}nonutf8\") {\n  return Err(anyhow!(\"TMP path is not valid UTF-8: {}\", s));\n}","typeGuard":"fn is_utf8_path(p: &std::path::Path) -> bool { p.to_str().is_some() }","tryCatchPattern":"// catch the abort: run bundling in a subprocess and map the panic message to\n// 'set TMP/TEMP to an ASCII-only directory'.","preventionTips":["Set TMP/TEMP to an ASCII-only path on build machines","Avoid non-ASCII Windows usernames for CI/build accounts","Prefer to_string_lossy or explicit errors over expect when converting OsStrings"],"tags":["msi","windows","encoding","utf-8","path"],"backgroundTag":"non-utf8-path","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"}