tauri-apps/tauri · error

failed to get bundle filename

Error message

failed to get bundle filename

What it means

This panic occurs in notarize_inner when app_bundle_path.file_stem() returns None, meaning the path has no file stem (e.g. it is '/', '..', or an empty/root path). The library expects a real .app bundle path to zip and submit to Apple's notarytool, and panics instead of returning an error because a valid bundle must always have a filename.

Solutions

  1. Verify the app_bundle_path passed to notarize points to an actual Foo.app directory before calling
  2. Check that any env var or config value supplying the bundle path is non-empty and resolves to a real path
  3. Use std::fs::metadata to confirm the bundle exists and is a directory
  4. Log the path immediately before the notarize call to catch misresolution early

Example fix

// before
notarize("/", &auth, true).unwrap();
// after
let bundle = std::path::Path::new("./target/release/bundle/macos/myapp.app");
assert!(bundle.is_dir(), "bundle path missing");
notarize(bundle, &auth, true).unwrap();
Defensive patterns

Strategy: validation

Validate before calling

let bundle = Path::new("target/release/bundle/macos/myapp.app");
if bundle.file_stem().is_none() || !bundle.is_dir() {
    panic!("invalid app bundle path: {}", bundle.display());
}
notarize(bundle, &auth, true)?;

Type guard

fn has_stem(p: &Path) -> bool { p.file_stem().is_some() }

Prevention

When it happens

Trigger: Calling tauri_plugin_macos_sign's notarize or notarize_without_stapling with an app_bundle_path that is a root path, empty, or otherwise lacks a final component with a stem.

Common situations: A build script resolved the .app bundle path incorrectly (e.g. env var not set, glob matched nothing and fell back to a directory root), or a CI variable interpolated to an empty string leaving the path as '/' or '.','.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18). Data as JSON: /api/errors/8d573e7d8b56459d. Report an issue: GitHub.

Appendix: source

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

}

pub fn notarize_without_stapling(
  keychain: &Keychain,
  app_bundle_path: &Path,
  auth: &AppleNotarizationCredentials,
) -> Result<()> {
  notarize_inner(keychain, app_bundle_path, auth, false)
}

fn notarize_inner(
  keychain: &Keychain,
  app_bundle_path: &Path,
  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"),
  ];

View on GitHub (pinned to 460ec35447)