{"record":{"id":"8c16b6625233bb29","repo":"tauri-apps/tauri","slug":"failed-to-read-binary-path","errorCode":null,"errorMessage":"failed to read binary path","messagePattern":"failed to read binary path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-bundler/src/bundle/windows/msi/mod.rs","lineNumber":957,"sourceCode":"    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\n  Ok(binaries)\n}\n\n#[derive(Serialize)]\nstruct MergeModule {\n  name: String,\n  path: String,\n}\n\nfn get_merge_modules(settings: &Settings) -> crate::Result<Vec<MergeModule>> {\n  let mut merge_modules = Vec::new();\n  let regex = Regex::new(r\"[^\\w\\d\\.]\")?;\n  for msm in glob::glob(","sourceCodeStart":939,"sourceCodeEnd":975,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-bundler/src/bundle/windows/msi/mod.rs#L939-L975","documentation":"For each non-main binary, generate_binaries_data converts settings.binary_path(bin) into a String via into_string().expect(\"failed to read binary path\"). This panics when the resolved binary path is not valid UTF-8, because OsString::into_string returns Err for non-UTF-8 content.","triggerScenarios":"Calling bundle_project when the project or target directory path contains characters outside UTF-8 (legacy codepage characters, raw bytes in symlink targets) such that binary_path() yields a non-UTF-8 OsString.","commonSituations":"Building from a directory path with non-ASCII characters on Windows with a legacy codepage, or a target/ directory placed under such a path via CARGO_TARGET_DIR.","solutions":["Move the project (or set CARGO_TARGET_DIR) to an ASCII-only path and rebuild.","On Windows, enable UTF-8 codepage (Beta: Use Unicode UTF-8 for worldwide language support) or set the build environment to UTF-8.","Replace the expect with to_string_lossy() or a proper error to make the failure diagnosable."],"exampleFix":"// before\npath: settings.binary_path(bin).into_os_string().into_string().expect(\"failed to read binary path\"),\n\n// after\npath: settings.binary_path(bin).to_string_lossy().into_owned(),","handlingStrategy":"validation","validationCode":"// verify project and target dirs are UTF-8 before bundling\nfor p in [project_dir.clone(), target_dir.clone()] {\n  if p.to_str().is_none() {\n    return Err(anyhow!(\"path is not valid UTF-8: {}\", p.to_string_lossy()));\n  }\n}","typeGuard":"fn is_utf8_path(p: &std::path::Path) -> bool { p.to_str().is_some() }","tryCatchPattern":"// run bundling in a child process and translate the panic into\n// 'move project/target dir to a UTF-8-safe path'.","preventionTips":["Keep project and CARGO_TARGET_DIR paths ASCII-only on Windows","Enable the UTF-8 system codepage on Windows build machines","Check binary_path results for UTF-8 validity in preflight checks"],"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"}