tauri-apps/tauri · error

No file name

Error message

No file name

What it means

In the macOS app bundler's create_info_plist, when a bundle icon file was resolved, `CFBundleIconFile` is set from the path's `file_name()`. If that path has no final component, the expect panics with "No file name". It indicates the computed icon path is malformed (directory-like) rather than pointing to an icon file.

Solutions

  1. Point `bundle.icon` in tauri.conf.json at actual icon files (e.g. `icons/icon.icns`), not directories.
  2. Verify the icon file exists for the macOS target (an .icns or supported PNG) so bundle_icon_file resolves to a real file.
  3. Regenerate icons with `tauri icon` to produce a consistent set including icon.icns.
  4. If reproducing internally, guard with `if let Some(name) = path.file_name()` and skip/fallback instead of panicking.

Example fix

// before
"icon": ["icons/"]
// after
"icon": ["icons/icon.icns", "icons/128x128.png"]
Defensive patterns

Strategy: validation

Validate before calling

for icon in &config.bundle.icon {
  let p = std::path::Path::new(icon);
  assert!(p.is_file(), "icon is not a file: {icon}");
  assert!(p.file_name().is_some(), "icon path has no filename: {icon}");
}

Type guard

fn valid_icon_path(p: &std::path::Path) -> bool { p.is_file() && p.file_name().is_some() }

Prevention

When it happens

Trigger: tauri build creating a macOS .app bundle where bundle_icon_file was built from an icon path lacking a filename (trailing slash, `..`, or root), then inserted into Info.plist.

Common situations: Icon configuration pointing at a directory instead of a file; a path manipulation bug where the icon's parent directory was passed instead of the file; unusual icon extension/config values causing downstream path joins to lose the filename.

Related errors


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

Appendix: source

Thrown at crates/tauri-bundler/src/bundle/macos/app.rs:281

  if let Some(associations) = settings.file_associations() {
    if let Some(file_associations_plist) =
      tauri_utils::config::file_associations_plist(associations)
    {
      if let Some(plist_dict) = file_associations_plist.as_dictionary() {
        for (key, value) in plist_dict {
          plist.insert(key.clone(), value.clone());
        }
      }
    }
  }

  if let Some(path) = bundle_icon_file {
    plist.insert(
      "CFBundleIconFile".into(),
      path
        .file_name()
        .expect("No file name")
        .to_string_lossy()
        .into_owned()
        .into(),
    );
  }

  if let Some(assets_car_file) = assets_car_file {
    if let Some(icon_name) = app_icon_name_from_assets_car(&assets_car_file) {
      // only set CFBundleIconName for the Assets.car, CFBundleIconFile is the fallback icns file
      plist.insert("CFBundleIconName".into(), icon_name.clone().into());
    } else {
      log::warn!("Failed to get icon name from Assets.car file");
    }
  }

  if let Some(protocols) = settings.deep_link_protocols() {
    plist.insert(
      "CFBundleURLTypes".into(),

View on GitHub (pinned to 460ec35447)