tauri-apps/tauri · error
Could not get icon filename
Error message
Could not get icon filename
What it means
Panics in create_icns_file when it cannot derive a filename from an icon path while collecting icons for the macOS .icns bundle. Called from bundle_project on macOS; a missing or non-UTF-8 file_name on an icon path supplied via settings makes the filename extraction impossible, aborting the bundle.
Solutions
- Ensure every configured icon path has a valid, non-empty filename with a normal extension.
- Check bundle > icon entries in tauri.conf.json for malformed paths or trailing slashes.
- Supply at least one valid .icns or .png icon before building for macOS.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tauri-bundler/src/bundle/macos/icon.rs:32 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18).
Data as JSON: /api/errors/dd65c1e5a690fb09.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tauri-bundler/src/bundle/macos/icon.rs:32
process::Command,
};
use image::GenericImageView;
// Given a list of icon files, try to produce an ICNS file in the out_dir
// and return the path to it. Returns `Ok(None)` if no usable icons
// were provided.
pub fn create_icns_file(out_dir: &Path, settings: &Settings) -> crate::Result<Option<PathBuf>> {
if settings.icon_files().count() == 0 {
return Ok(None);
}
// If one of the icon files is already an ICNS file, just use that.
for icon_path in settings.icon_files() {
let icon_path = icon_path?;
if icon_path.extension() == Some(OsStr::new("icns")) {
let mut dest_path = out_dir.to_path_buf();
dest_path.push(icon_path.file_name().expect("Could not get icon filename"));
fs_utils::copy_file(&icon_path, &dest_path)?;
return Ok(Some(dest_path));
}
}
// Otherwise, read available images and pack them into a new ICNS file.
let mut family = icns::IconFamily::new();
fn add_icon_to_family(
icon: image::DynamicImage,
density: u32,
family: &mut icns::IconFamily,
) -> io::Result<()> {
// Try to add this image to the icon family. Ignore images whose sizes
// don't map to any ICNS icon type; print warnings and skip images that
// fail to encode.
match icns::IconType::from_pixel_size_and_density(icon.width(), icon.height(), density) {
Some(icon_type) => {View on GitHub (pinned to 460ec35447)