tauri-apps/tauri · error

failed to convert bundle_path to string

Error message

failed to convert bundle_path to string

What it means

Panic in tauri-macos-sign's notarization zip step: app_bundle_path.to_str().expect("failed to convert bundle_path to string") fails when the path contains bytes that are not valid UTF-8. The `ditto` command is invoked with string arguments, so a bundle path with a non-UTF-8 byte (common with legacy-encoded artifact names) aborts notarization.

Source

Thrown at crates/tauri-macos-sign/src/lib.rs:158

  auth: &AppleNotarizationCredentials,
  wait: bool,
) -> Result<()> {
  let bundle_stem = app_bundle_path
    .file_stem()
    .expect("failed to get bundle filename");

  let tmp_dir = tempfile::tempdir().map_err(Error::TempDir)?;
  let zip_path = tmp_dir
    .path()
    .join(format!("{}.zip", bundle_stem.to_string_lossy()));
  let zip_args = vec![
    "-c",
    "-k",
    "--keepParent",
    "--sequesterRsrc",
    app_bundle_path
      .to_str()
      .expect("failed to convert bundle_path to string"),
    zip_path
      .to_str()
      .expect("failed to convert zip_path to string"),
  ];

  // use ditto to create a PKZip almost identical to Finder
  // this remove almost 99% of false alarm in notarization
  assert_command(
    Command::new("ditto").args(zip_args).piped(),
    "failed to zip app with ditto",
  )
  .map_err(|error| Error::CommandFailed {
    command: "ditto".to_string(),
    error,
  })?;

  // sign the zip file
  keychain.sign(&zip_path, None, false)?;

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Move/rename the .app and its parent directories to pure ASCII/UTF-8 names before signing and notarizing
  2. Fix the pipeline step that produced the non-UTF-8 name and regenerate the artifact
  3. Validate early in your wrapper: path.to_str().is_some(), failing with a clear message naming the offending path

Example fix

# before
/Applications/My App\xa0.app  → panic: failed to convert bundle_path to string

# after
mv "$(printf 'My App\xa0.app')" "MyApp.app"
xcrun notarytool submit MyApp.app.zip ...
Defensive patterns

Strategy: validation

Validate before calling

fn is_utf8_path(p: &std::path::Path) -> bool { p.to_str().is_some() }
assert!(is_utf8_path(&app_bundle_path), "bundle path must be UTF-8 before notarize");

Type guard

fn utf8_path(p: &std::path::Path) -> Option<&str> { p.to_str() }

Prevention

When it happens

Trigger: Notarizing an .app whose full path includes non-UTF-8 bytes — e.g. a download/cache directory named with Latin-1 characters, or a bundle filename mangled by an unzip/archive tool.

Common situations: Artifacts produced on machines with legacy locale encodings; archives extracted with tools that preserve invalid byte sequences; CI workspaces named from user-provided strings.

Related errors


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