tauri-apps/tauri · error
failed to convert bundle filename to string
Error message
failed to convert bundle filename to string
What it means
staple_app converts the bundle filename to &str for the xcrun stapler invocation; the panic means the final path component contains invalid UTF-8. The filename must be passed as a command-line argument, which requires UTF-8.
Solutions
- Rename the .app bundle to a UTF-8 (preferably ASCII) name before notarizing
- Check any rename/copy step in the build script for byte-level operations
- Validate path.to_str() early in the pipeline
Example fix
// before mv "My App\xff.app" dist/My\xffApp.app // after mv "My App.app" dist/MyApp.app
Defensive patterns
Strategy: validation
Validate before calling
assert!(
bundle_path.file_name().and_then(|n| n.to_str()).is_some(),
"bundle filename must be valid UTF-8"
); Type guard
fn utf8_file_name(p: &Path) -> Option<&str> { p.file_name()?.to_str() } Prevention
- Name app bundles with plain ASCII identifiers
- Avoid byte-level rename operations in build scripts
- Validate the final bundle name before distribution steps
When it happens
Trigger: notarize finishing successfully and calling staple_app with a bundle whose file name has non-UTF-8 bytes.
Common situations: App bundles named with characters outside UTF-8 from unusual filesystems or scripted renames.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- failed to convert bundle_path to string
- failed to convert APPLE_PROVIDER_SHORT_NAME to string
- failed to convert APPLE_SIGNING_IDENTITY to string
- failed to convert base64 to string
- failed to convert zip_path to string
AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18).
Data as JSON: /api/errors/4ca72ac63bef6891.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tauri-macos-sign/src/lib.rs:258
String::from_utf8_lossy(&output.stdout)
)))
} else {
Err(Error::Notarize(log_message))
}
} else {
Err(Error::ParseNotarytoolOutput {
output: output_str.into_owned(),
})
}
}
fn staple_app(mut app_bundle_path: PathBuf) -> Result<()> {
let app_bundle_path_clone = app_bundle_path.clone();
let filename = app_bundle_path_clone
.file_name()
.expect("failed to get bundle filename")
.to_str()
.expect("failed to convert bundle filename to string");
app_bundle_path.pop();
Command::new("xcrun")
.args(vec!["stapler", "staple", "-v", filename])
.current_dir(app_bundle_path)
.output()
.map_err(|error| Error::CommandFailed {
command: "xcrun stapler staple".to_string(),
error,
})?;
Ok(())
}
pub trait NotarytoolCmdExt {
fn notarytool_args(
&mut self,View on GitHub (pinned to 460ec35447)