{"record":{"id":"54bb3c26f4df9534","repo":"tonhowtf/omniget","slug":"app-icon-not-found","errorCode":null,"errorMessage":"app icon not found","messagePattern":"app icon not found","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src-tauri/src/tray.rs","lineNumber":87,"sourceCode":"    // Empty, hidden until the frontend pushes localized channel labels via\n    // sync_channels_tray (the tray menu is native — $t is not reachable here).\n    let channels_submenu = SubmenuBuilder::new(app, \"Channels\").build()?;\n    channels_submenu.set_enabled(false).ok();\n    CHANNELS_SUBMENU.set(channels_submenu.clone()).ok();\n\n    let menu = MenuBuilder::new(app)\n        .item(&open_item)\n        .separator()\n        .item(&downloads_item)\n        .item(&channels_submenu)\n        .separator()\n        .item(&quit_item)\n        .build()?;\n\n    let icon = app\n        .default_window_icon()\n        .cloned()\n        .expect(\"app icon not found\");\n\n    BASE_ICON\n        .set((icon.rgba().to_vec(), icon.width(), icon.height()))\n        .ok();\n\n    TrayIconBuilder::with_id(\"main-tray\")\n        .icon(icon)\n        .tooltip(\"OmniGet\")\n        .menu(&menu)\n        .on_menu_event(|app, event| match event.id().as_ref() {\n            \"open\" => show_window(app),\n            \"quit\" => {\n                request_quit(app);\n            }\n            other => {\n                if let Some(channel_id) = other.strip_prefix(\"chk:\") {\n                    let app = app.clone();\n                    let channel_id = channel_id.to_string();","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/tray.rs#L69-L105","documentation":"In tray.rs setup(), the tray icon is obtained from app.default_window_icon().cloned(), which returns Option; the code .expect(\"app icon not found\") panics when no default window icon is configured or bundled. The icon is then cached into BASE_ICON for later tray redraws.","triggerScenarios":"Tauri app.setup runs while the bundle/window icon is absent: no \"icon\" entry in tauri.conf.json bundle config, icons not embedded because bundle.active is false or generate_context! was built without icon assets, or running a debug/dev build where icons weren't bundled.","commonSituations":"Fresh project missing src-tauri/icons after cleaning the folder; tauri.conf.json icons array emptied; building with a context that excludes icons; running tests without the bundled resources.","solutions":["Add valid icons to tauri.conf.json (bundle.icon array) and rebuild so generate_context! embeds a default window icon.","Restore the default icons shipped with tauri (npx tauri icon path/to/source.png regenerates src-tauri/icons).","Replace the .expect with a fallback: if default_window_icon() is None, load the icon from bytes included via include_bytes!.","Guard setup so tray creation is skipped (with a warning) when no icon is available, instead of panicking."],"exampleFix":"// before\nlet icon = app\n    .default_window_icon()\n    .cloned()\n    .expect(\"app icon not found\");\n\n// after\nlet icon = app.default_window_icon().cloned().unwrap_or_else(|| {\n    let bytes = include_bytes!(\"../icons/icon.png\");\n    tauri::image::Image::from_bytes(bytes).expect(\"bundled fallback icon\").clone()\n});","handlingStrategy":"fallback","validationCode":"// check at startup\nif app.default_window_icon().is_none() {\n    tracing::warn!(\"no default window icon; tray will use fallback\");\n}","typeGuard":null,"tryCatchPattern":"let icon = match app.default_window_icon().cloned() {\n    Some(icon) => icon,\n    None => tauri::image::Image::from_bytes(include_bytes!(\"../icons/icon.png\")).expect(\"fallback icon\").clone(),\n};","preventionTips":["Keep bundle.icon populated in tauri.conf.json","Regenerate icons with `tauri icon` after branding changes","Never .expect on Option-returning icon APIs; bundle a fallback via include_bytes!"],"tags":["tauri","tray","icons","panic"],"backgroundTag":"resource-not-found","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}