tauri-apps/tauri · error

couldn't find a square icon to use as AppImage icon

Error message

couldn't find a square icon to use as AppImage icon

What it means

When building an AppImage, tauri-bundler selects the largest square icon (width == height) to hand to linuxdeploy as the AppImage icon. max_by_key over an empty filtered iterator returns None, so the expect panics when not a single configured icon has equal width and height.

Source

Thrown at crates/tauri-bundler/src/bundle/linux/appimage/linuxdeploy.rs:101

    .with_context(|| "Failed to copy custom files")?;

  fs::create_dir_all(&output_path)?;
  let app_dir_path = output_path.join(format!("{}.AppDir", settings.product_name()));
  let appimage_filename = format!(
    "{}_{}_{}.AppImage",
    settings.product_name(),
    settings.version_string(),
    appimage_arch
  );
  let appimage_path = output_path.join(&appimage_filename);
  fs_utils::create_dir(&app_dir_path, true)?;

  fs::create_dir_all(&tools_path)?;
  let larger_icon = icons
    .iter()
    .filter(|i| i.width == i.height)
    .max_by_key(|i| i.width)
    .expect("couldn't find a square icon to use as AppImage icon");
  let larger_icon_path = larger_icon
    .path
    .strip_prefix(package_dir.join("data"))
    .unwrap()
    .to_string_lossy()
    .to_string();

  log::info!(action = "Bundling"; "{} ({})", appimage_filename, appimage_path.display());

  let app_dir_usr = app_dir_path.join("usr/");
  let app_dir_usr_bin = app_dir_usr.join("bin/");
  let app_dir_usr_lib = app_dir_usr.join("lib/");

  fs_utils::copy_dir(&data_dir.join("usr/"), &app_dir_usr)?;

  // Using create_dir_all for a single dir so we don't get errors if the path already exists
  fs::create_dir_all(&app_dir_usr_bin)?;
  fs::create_dir_all(app_dir_usr_lib)?;

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Add at least one square PNG (ideally 32/128/256/512px squares) to bundle.icon in tauri.conf.json
  2. Regenerate a full default set from a square 1024x1024 source: tauri icon path/to/icon.png
  3. Verify each listed file is truly square: identify icons/*.png (ImageMagick) or file icons/*.png

Example fix

// tauri.conf.json — before (only non-square artwork)
"icon": ["icons/banner-1024x768.png"]

// after (square set included)
"icon": [
  "icons/32x32.png",
  "icons/128x128.png",
  "icons/128x128@2x.png",
  "icons/banner-1024x768.png"
]
Defensive patterns

Strategy: validation

Validate before calling

# preflight: at least one square PNG must exist before bundling AppImages
python3 - <<'EOF'
from PIL import Image
import glob, sys
ok = any((lambda s: s[0] == s[1])(Image.open(p).size) for p in glob.glob('icons/*.png'))
sys.exit(0 if ok else 1)
EOF

Prevention

When it happens

Trigger: tauri build --bundles appimage with a bundle.icon list whose entries are all non-square (e.g. only 1024x768 banners), or icon files whose dimensions cannot be determined so they are filtered out before the max_by_key.

Common situations: Replacing the default Tauri icon set with marketing artwork; icon export tools that preserve aspect ratio and produce 512x384-style files; trimming tauri.conf.json's icon list down to one non-square PNG.

Related errors


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