tauri-apps/tauri · error

failed to convert merge module filename to string

Error message

failed to convert merge module filename to string

What it means

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.

Source

Thrown at crates/tauri-bundler/src/bundle/windows/msi/mod.rs:984

}

fn get_merge_modules(settings: &Settings) -> crate::Result<Vec<MergeModule>> {
  let mut merge_modules = Vec::new();
  let regex = Regex::new(r"[^\w\d\.]")?;
  for msm in glob::glob(
    &PathBuf::from(glob::Pattern::escape(
      &settings.project_out_directory().to_string_lossy(),
    ))
    .join("*.msm")
    .to_string_lossy(),
  )? {
    let path = msm?;
    let filename = path
      .file_name()
      .expect("failed to extract merge module filename")
      .to_os_string()
      .into_string()
      .expect("failed to convert merge module filename to string");
    merge_modules.push(MergeModule {
      name: regex.replace_all(&filename, "").to_string(),
      path: path.to_string_lossy().to_string(),
    });
  }
  Ok(merge_modules)
}

/// Generates the data required for the resource bundling on wix
fn generate_resource_data(settings: &Settings) -> crate::Result<ResourceDirectory> {
  let cwd = std::env::current_dir()?;

  let mut root_resource_directory = ResourceDirectory::default();
  let mut added_resources = HashSet::new();

  for resource in settings.resource_files().iter() {
    let resource = resource?;

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Rename the offending .msm to a plain ASCII file name and rebuild
  2. Find and fix the build step that produced the badly named .msm
  3. Remove stray .msm files from the out directory if they were not intended to be merged

Example fix

# before — legacy-encoded file name in target/release/
M�dul�.msm

# after
ren "M?dul?.msm" MyModule.msm
tauri build --bundles msi
Defensive patterns

Strategy: validation

Validate before calling

# preflight: every merge module file name must be pure ASCII
find target/release -maxdepth 2 -name '*.msm' | LC_ALL=C grep -P '[^\x00-\x7F]' && { echo 'non-ASCII .msm file name found'; exit 1; } || true

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/19b6d20630693208. Report an issue: GitHub.