{"record":{"id":"b11f2cfd5aca6065","repo":"tauri-apps/tauri","slug":"couldn-t-find-a-square-icon-to-use-as-appimage-ico","errorCode":null,"errorMessage":"couldn't find a square icon to use as AppImage icon","messagePattern":"couldn't find a square icon to use as AppImage icon","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-bundler/src/bundle/linux/appimage/linuxdeploy.rs","lineNumber":101,"sourceCode":"    .with_context(|| \"Failed to copy custom files\")?;\n\n  fs::create_dir_all(&output_path)?;\n  let app_dir_path = output_path.join(format!(\"{}.AppDir\", settings.product_name()));\n  let appimage_filename = format!(\n    \"{}_{}_{}.AppImage\",\n    settings.product_name(),\n    settings.version_string(),\n    appimage_arch\n  );\n  let appimage_path = output_path.join(&appimage_filename);\n  fs_utils::create_dir(&app_dir_path, true)?;\n\n  fs::create_dir_all(&tools_path)?;\n  let larger_icon = icons\n    .iter()\n    .filter(|i| i.width == i.height)\n    .max_by_key(|i| i.width)\n    .expect(\"couldn't find a square icon to use as AppImage icon\");\n  let larger_icon_path = larger_icon\n    .path\n    .strip_prefix(package_dir.join(\"data\"))\n    .unwrap()\n    .to_string_lossy()\n    .to_string();\n\n  log::info!(action = \"Bundling\"; \"{} ({})\", appimage_filename, appimage_path.display());\n\n  let app_dir_usr = app_dir_path.join(\"usr/\");\n  let app_dir_usr_bin = app_dir_usr.join(\"bin/\");\n  let app_dir_usr_lib = app_dir_usr.join(\"lib/\");\n\n  fs_utils::copy_dir(&data_dir.join(\"usr/\"), &app_dir_usr)?;\n\n  // Using create_dir_all for a single dir so we don't get errors if the path already exists\n  fs::create_dir_all(&app_dir_usr_bin)?;\n  fs::create_dir_all(app_dir_usr_lib)?;","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-bundler/src/bundle/linux/appimage/linuxdeploy.rs#L83-L119","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add at least one square PNG (ideally 32/128/256/512px squares) to bundle.icon in tauri.conf.json","Regenerate a full default set from a square 1024x1024 source: tauri icon path/to/icon.png","Verify each listed file is truly square: identify icons/*.png (ImageMagick) or file icons/*.png"],"exampleFix":"// tauri.conf.json — before (only non-square artwork)\n\"icon\": [\"icons/banner-1024x768.png\"]\n\n// after (square set included)\n\"icon\": [\n  \"icons/32x32.png\",\n  \"icons/128x128.png\",\n  \"icons/128x128@2x.png\",\n  \"icons/banner-1024x768.png\"\n]","handlingStrategy":"validation","validationCode":"# preflight: at least one square PNG must exist before bundling AppImages\npython3 - <<'EOF'\nfrom PIL import Image\nimport glob, sys\nok = any((lambda s: s[0] == s[1])(Image.open(p).size) for p in glob.glob('icons/*.png'))\nsys.exit(0 if ok else 1)\nEOF","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Start icon sets from `tauri icon <square-source.png>` so squares are always present","Add a CI check that the icon glob contains at least one width==height image","Never replace the whole default icon list with non-square artwork"],"tags":["appimage","linux","icons","tauri-bundler","config"],"backgroundTag":"missing-required-asset","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}