{"record":{"id":"c61603f8b00965db","repo":"tauri-apps/tauri","slug":"no-matching-icontype","errorCode":null,"errorMessage":"No matching IconType","messagePattern":"No matching IconType","errorType":"exception","errorClass":"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/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-bundler/src/bundle/macos/icon.rs#L39-L75","documentation":"When building an .icns file, add_icon_to_family maps each PNG icon size to an icns IconType via IconType::from_png. If the image's dimensions don't correspond to any known ICNS icon type, the function returns this InvalidData io::Error instead of adding an icon to the family.","triggerScenarios":"Calling create_icns_file with a source PNG whose width/height (after decoding) does not match any standard ICNS icon size (16, 32, 64, 128, 256, 512, 1024 px, incl. @2x variants).","commonSituations":"Developers drop a non-square icon (e.g. 100x100) or an oddly sized PNG into tauri.conf.json > bundle > icon; icons generated by tools at non-standard sizes (e.g. 300x300) hit this during `tauri build` on macOS.","solutions":["Resize every icon listed in tauri.conf.json to standard square ICNS sizes (16, 32, 64, 128, 256, 512, 1024 px), ideally 1024x1024 as the single source","Regenerate the icon set with `tauri icon path/to/icon.png` so all sizes are produced correctly","Verify the PNG decodes to the expected dimensions (e.g. with `file icon.png` or an image tool) before bundling"],"exampleFix":"// before (tauri.conf.json)\n\"icon\": [\"./icons/custom-300x300.png\"]\n// after\n\"icon\": [\"./icons/32x32.png\", \"./icons/128x128.png\", \"./icons/icon.icns\"]","handlingStrategy":"validation","validationCode":"// before build: ensure all icon PNGs are standard square ICNS sizes\nconst SIZES = [16,32,64,128,256,512,1024];\nfor (const p of cfg.bundle.icon.filter(i => i.endsWith('.png'))) {\n  const { width, height } = await imageSize(p);\n  if (width !== height || !SIZES.includes(width)) throw new Error(`${p}: ${width}x${height} is not a valid ICNS size`);\n}","typeGuard":"function isValidIcnsSize(w, h) {\n  return w === h && [16,32,64,128,256,512,1024].includes(w);\n}","tryCatchPattern":null,"preventionTips":["Generate icons with `tauri icon` from a single 1024x1024 source PNG","Keep only standard sizes in tauri.conf.json > bundle > icon","Validate icon dimensions in CI before running tauri build"],"tags":["macos","icons","bundling","icns"],"backgroundTag":"unsupported-enum-value","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}