{"record":{"id":"19b6d20630693208","repo":"tauri-apps/tauri","slug":"failed-to-convert-merge-module-filename-to-string","errorCode":null,"errorMessage":"failed to convert merge module filename to string","messagePattern":"failed to convert merge module filename to string","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-bundler/src/bundle/windows/msi/mod.rs","lineNumber":984,"sourceCode":"}\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(\n    &PathBuf::from(glob::Pattern::escape(\n      &settings.project_out_directory().to_string_lossy(),\n    ))\n    .join(\"*.msm\")\n    .to_string_lossy(),\n  )? {\n    let path = msm?;\n    let filename = path\n      .file_name()\n      .expect(\"failed to extract merge module filename\")\n      .to_os_string()\n      .into_string()\n      .expect(\"failed to convert merge module filename to string\");\n    merge_modules.push(MergeModule {\n      name: regex.replace_all(&filename, \"\").to_string(),\n      path: path.to_string_lossy().to_string(),\n    });\n  }\n  Ok(merge_modules)\n}\n\n/// Generates the data required for the resource bundling on wix\nfn generate_resource_data(settings: &Settings) -> crate::Result<ResourceDirectory> {\n  let cwd = std::env::current_dir()?;\n\n  let mut root_resource_directory = ResourceDirectory::default();\n  let mut added_resources = HashSet::new();\n\n  for resource in settings.resource_files().iter() {\n    let resource = resource?;\n","sourceCodeStart":966,"sourceCodeEnd":1002,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-bundler/src/bundle/windows/msi/mod.rs#L966-L1002","documentation":"Each globbed .msm merge module's file name is converted from an OsString to a UTF-8 String for the WiX data. into_string() fails when the .msm file name contains non-UTF-8 bytes — typically a merge module dropped into the out directory with a legacy-encoded (ANSI/mojibake) name.","triggerScenarios":"MSI bundling when a manually placed *.msm file under target/<profile>/ (or produced by a build step) has a file name that is not valid UTF-8.","commonSituations":"Merge modules copied from legacy Windows systems with ANSI-encoded names; tooling that renames .msm files using a wrong encoding; usually alongside other non-UTF-8 path issues.","solutions":["Rename the offending .msm to a plain ASCII file name and rebuild","Find and fix the build step that produced the badly named .msm","Remove stray .msm files from the out directory if they were not intended to be merged"],"exampleFix":"# before — legacy-encoded file name in target/release/\nM�dul�.msm\n\n# after\nren \"M?dul?.msm\" MyModule.msm\ntauri build --bundles msi","handlingStrategy":"validation","validationCode":"# preflight: every merge module file name must be pure ASCII\nfind target/release -maxdepth 2 -name '*.msm' | LC_ALL=C grep -P '[^\\x00-\\x7F]' && { echo 'non-ASCII .msm file name found'; exit 1; } || true","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Name merge modules in plain ASCII","Check .msm file names in CI before MSI bundling steps","Avoid copying .msm files from legacy systems without renaming them"],"tags":["windows","msi","wix","merge-module","utf-8","tauri-bundler"],"backgroundTag":"non-utf8-path","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}