tauri-apps/tauri · error

failed to extract external binary filename

Error message

failed to extract external binary filename

What it means

generate_binaries_data copies each external binary (sidecar, from bundle.externalBin) into the temp directory and derives its MSI file id from the source's file_name. file_name() is None when the path is a root or ends with '..', so a degenerate externalBin path panics during MSI data generation.

Source

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

    }

    output_paths.push(msi_path);
  }

  Ok(output_paths)
}

/// Generates the data required for the external binaries and extra binaries bundling.
fn generate_binaries_data(settings: &Settings) -> crate::Result<Vec<Binary>> {
  let mut binaries = Vec::new();
  let cwd = std::env::current_dir()?;
  let tmp_dir = std::env::temp_dir();
  for src in settings.external_binaries() {
    let src = src?;
    let binary_path = cwd.join(&src);
    let dest_filename = src
      .file_name()
      .expect("failed to extract external binary filename")
      .to_string_lossy()
      .replace(&format!("-{}", settings.target()), "");
    let dest = tmp_dir.join(&dest_filename);
    std::fs::copy(binary_path, &dest)?;

    binaries.push(Binary {
      guid: Uuid::new_v4().to_string(),
      path: dest
        .into_os_string()
        .into_string()
        .expect("failed to read external binary path"),
      id: wix_identifier(&dest_filename),
    });
  }

  for bin in settings.binaries() {
    if !bin.main() {
      binaries.push(Binary {

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Fix the externalBin entry to name the sidecar file with its target-triple suffix, e.g. binaries/my-sidecar-x86_64-pc-windows-msvc.exe
  2. Check generated tauri.conf.json for unset variables or copy-paste typos that strip the file name
  3. Confirm the sidecar file exists with the -<target> suffix before bundling

Example fix

// tauri.conf.json — before
"externalBin": ["binaries/.."]

// after
"externalBin": ["binaries/my-sidecar-x86_64-pc-windows-msvc.exe"]
Defensive patterns

Strategy: validation

Validate before calling

// validate externalBin entries before MSI bundling
const last = (p) => p.split('/').pop() ?? '';
const bad = (config.bundle.externalBin ?? []).filter((p) => ['', '.', '..'].includes(last(p)));
if (bad.length) throw new Error(`externalBin entries without a file name: ${bad.join(', ')}`);

Type guard

const hasSidecarFileName = (p) => { const seg = p.split('/').pop() ?? ''; return seg.length > 0 && seg !== '.' && seg !== '..'; };

Prevention

When it happens

Trigger: MSI bundling (tauri build --bundles msi) with a bundle.externalBin entry such as '..' or a directory-like path lacking a final file component, so src.file_name() returns None.

Common situations: Same class as the Linux sidecar failure: script-generated configs with empty variable interpolation or typos; only surfaces on Windows MSI builds because this code path is MSI-specific.

Related errors


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