tauri-apps/tauri · error · std::io::Error

No matching IconType

Error message

No matching IconType

What it means

When the macOS bundler builds the .icns file it maps each icon image to a known ICNS icon type via icns::IconType::from_pixel_size_and_density(width, height, density). The icns crate only recognizes square sizes from 16px up to 1024px, plus their @2x retina equivalents (density from the filename). If no ICNS type matches, the image is rejected with io::ErrorKind::InvalidData and the bundle step fails.

Source

Thrown at crates/tauri-bundler/src/bundle/macos/icon.rs:57

  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) => {
        if !family.has_icon_with_type(icon_type) {
          let icon = make_icns_image(icon)?;
          family.add_icon_with_type(&icon, icon_type)?;
        }
        Ok(())
      }
      None => Err(io::Error::new(
        io::ErrorKind::InvalidData,
        "No matching IconType",
      )),
    }
  }

  let mut images_to_resize: Vec<(image::DynamicImage, u32, u32)> = vec![];
  for icon_path in settings.icon_files() {
    let icon_path = icon_path?;

    if icon_path.extension().is_some_and(|ext| ext == "car") {
      continue;
    }

    let icon = image::open(&icon_path)?;
    let density = if utils::is_retina(&icon_path) { 2 } else { 1 };
    let (w, h) = icon.dimensions();
    let orig_size = min(w, h);

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Regenerate a compliant icon set from one square 8-bit PNG (at least 1024x1024) with `tauri icon path/to/icon.png` and point bundle.icon at the generated icons/ directory
  2. Audit every path in `bundle.icon`: each image must be square and one of 16/32/64/128/256/512/1024 px, or an @2x file whose pixel size doubles a logical size (max 512@2x = 1024)
  3. Resize or drop oversized entries, e.g. `magick icons/2048x2048.png -resize 1024x1024 icons/1024x1024.png`
  4. Keep store/marketing artwork outside `bundle.icon` so the bundler never touches it

Example fix

// before (tauri.conf.json):
"icon": ["icons/2048x2048.png", "icons/32x32.png"]
// after:
"icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"]
Defensive patterns

Strategy: validation

Validate before calling

# verify icons are square, <= 1024px, before bundling
for f in src-tauri/icons/*.png; do
  read w h < <(magick identify -format '%w %h' "$f")
  [ "$w" = "$h" ] || { echo "non-square icon: $f (${w}x${h})"; exit 1; }
  [ "$w" -le 1024 ] || { echo "icon too large: $f (${w}x${h})"; exit 1; }
done

Prevention

When it happens

Trigger: `tauri build` on macOS when `bundle.icon` contains an image that still does not map to an ICNS type after the power-of-two resize pass: images larger than 1024x1024 (a 2048x2048 PNG goes through unresized because 2048 is itself a power of two), non-square images (e.g. 512x256), or a width/height/density combination with no ICNS entry.

Common situations: Designers delivering a 2048px or 4096px marketing export as the app icon; non-square icons; hand-maintained icon lists instead of the set generated by `tauri icon`; @2x retina files whose logical size has no ICNS slot.

Related errors


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