tauri-apps/tauri · error
Failed to create locale file
Error message
Failed to create locale file
What it means
The MSI bundler writes the assembled WiX localization file locale.wxl into the bundle output directory. File::create fails — triggering the expect — when the output path cannot be created: permission denied, missing parent directory, Windows path-length limits exceeded, or the volume being full.
Source
Thrown at crates/tauri-bundler/src/bundle/windows/msi/mod.rs:876
for locale_string in locale_strings.split('\n').filter(|s| !s.is_empty()) {
// strip `<String ` prefix and `>{value}</String` suffix.
let id = locale_string
.chars()
.skip(prefix_len)
.take(locale_string.find('>').unwrap() - prefix_len)
.collect::<String>();
if !locale_contents.contains(&id) {
unset_locale_strings.push_str(locale_string);
}
}
let locale_contents = locale_contents.replace(
"</WixLocalization>",
&format!("{unset_locale_strings}</WixLocalization>"),
);
let locale_path = output_path.join("locale.wxl");
{
let mut fileout = File::create(&locale_path).expect("Failed to create locale file");
fileout.write_all(locale_contents.as_bytes())?;
}
let arguments = vec![
format!(
"-cultures:{}",
if language == "en-US" {
language.to_lowercase()
} else {
format!("{};en-US", language.to_lowercase())
}
),
"-loc".into(),
display_path(&locale_path),
"*.wixobj".into(),
];
let msi_output_path = output_path.join("output.msi");
let msi_path =View on GitHub (pinned to 52e4b6e71d)
Solutions
- Move or clone the project closer to the drive root (e.g. C:\src\my-app) to shorten the path
- Free disk space and re-run tauri build --bundles msi
- Exclude target/ from antivirus scanning and stop concurrent cleaners during bundling
- Enable Windows long-path support (LongPathsEnabled group policy / recent Windows builds) and use a current CLI
Defensive patterns
Strategy: validation
Validate before calling
# preflight on the bundler host
DF_BEFORE=$(df -k . | awk 'NR==2 {print $4}')
[ "$DF_BEFORE" -gt 1048576 ] || { echo 'less than 1GB free — bundling may fail'; exit 1; }
mkdir -p target/release/bundle/msi && test -w target/release/bundle/msi || exit 1 Prevention
- Keep Tauri project paths short on Windows (close to the drive root)
- Exclude target/ from antivirus real-time scanning
- Check free disk space before starting bundling jobs
When it happens
Trigger: tauri build --bundles msi where target/release/bundle/msi/ is unwritable or was deleted mid-run, the absolute locale.wxl path exceeds classic Windows MAX_PATH (deep project directory plus long product name), or the disk is out of space.
Common situations: Projects nested many levels deep on Windows (C:\Users\...\very\long\path\); antivirus removing files under target/; CI runners with small disk quotas; cleanup scripts racing the bundler.
Related errors
- Language {} not found. It must be one of {}
- Failed to setup custom handlebar template
- Failed to setup handlebar template
- failed to extract merge module filename
- failed to convert merge module filename to string
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/923c4edd41939ebd.
Report an issue: GitHub.