{"record":{"id":"c61603f8b00965db","repo":"tauri-apps/tauri","slug":"no-matching-icontype","errorCode":null,"errorMessage":"No matching IconType","messagePattern":"No matching IconType","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-bundler/src/bundle/macos/icon.rs","lineNumber":57,"sourceCode":"  let mut family = icns::IconFamily::new();\n\n  fn add_icon_to_family(\n    icon: image::DynamicImage,\n    density: u32,\n    family: &mut icns::IconFamily,\n  ) -> io::Result<()> {\n    // Try to add this image to the icon family.  Ignore images whose sizes\n    // don't map to any ICNS icon type; print warnings and skip images that\n    // fail to encode.\n    match icns::IconType::from_pixel_size_and_density(icon.width(), icon.height(), density) {\n      Some(icon_type) => {\n        if !family.has_icon_with_type(icon_type) {\n          let icon = make_icns_image(icon)?;\n          family.add_icon_with_type(&icon, icon_type)?;\n        }\n        Ok(())\n      }\n      None => Err(io::Error::new(\n        io::ErrorKind::InvalidData,\n        \"No matching IconType\",\n      )),\n    }\n  }\n\n  let mut images_to_resize: Vec<(image::DynamicImage, u32, u32)> = vec![];\n  for icon_path in settings.icon_files() {\n    let icon_path = icon_path?;\n\n    if icon_path.extension().is_some_and(|ext| ext == \"car\") {\n      continue;\n    }\n\n    let icon = image::open(&icon_path)?;\n    let density = if utils::is_retina(&icon_path) { 2 } else { 1 };\n    let (w, h) = icon.dimensions();\n    let orig_size = min(w, h);","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-bundler/src/bundle/macos/icon.rs#L39-L75","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["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","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)","Resize or drop oversized entries, e.g. `magick icons/2048x2048.png -resize 1024x1024 icons/1024x1024.png`","Keep store/marketing artwork outside `bundle.icon` so the bundler never touches it"],"exampleFix":"// before (tauri.conf.json):\n\"icon\": [\"icons/2048x2048.png\", \"icons/32x32.png\"]\n// after:\n\"icon\": [\"icons/32x32.png\", \"icons/128x128.png\", \"icons/128x128@2x.png\", \"icons/icon.icns\", \"icons/icon.ico\"]","handlingStrategy":"validation","validationCode":"# verify icons are square, <= 1024px, before bundling\nfor f in src-tauri/icons/*.png; do\n  read w h < <(magick identify -format '%w %h' \"$f\")\n  [ \"$w\" = \"$h\" ] || { echo \"non-square icon: $f (${w}x${h})\"; exit 1; }\n  [ \"$w\" -le 1024 ] || { echo \"icon too large: $f (${w}x${h})\"; exit 1; }\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate the whole icon set with `tauri icon` instead of hand-adding files","Never put marketing artwork (>1024px) into bundle.icon","Add the square/size check to CI so bad icons fail before the macOS bundler runs"],"tags":["macos","icns","icon","image-size","bundler"],"backgroundTag":"invalid-image-dimensions","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}