tonhowtf/omniget · critical
app icon not found
Error message
app icon not found
What it means
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.
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.
Example fix
// before
let icon = app
.default_window_icon()
.cloned()
.expect("app icon not found");
// after
let icon = app.default_window_icon().cloned().unwrap_or_else(|| {
let bytes = include_bytes!("../icons/icon.png");
tauri::image::Image::from_bytes(bytes).expect("bundled fallback icon").clone()
}); Defensive patterns
Strategy: fallback
Validate before calling
// check at startup
if app.default_window_icon().is_none() {
tracing::warn!("no default window icon; tray will use fallback");
} Try / catch
let icon = match app.default_window_icon().cloned() {
Some(icon) => icon,
None => tauri::image::Image::from_bytes(include_bytes!("../icons/icon.png")).expect("fallback icon").clone(),
}; Prevention
- 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!
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/54bb3c26f4df9534.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/tray.rs:87
// Empty, hidden until the frontend pushes localized channel labels via
// sync_channels_tray (the tray menu is native — $t is not reachable here).
let channels_submenu = SubmenuBuilder::new(app, "Channels").build()?;
channels_submenu.set_enabled(false).ok();
CHANNELS_SUBMENU.set(channels_submenu.clone()).ok();
let menu = MenuBuilder::new(app)
.item(&open_item)
.separator()
.item(&downloads_item)
.item(&channels_submenu)
.separator()
.item(&quit_item)
.build()?;
let icon = app
.default_window_icon()
.cloned()
.expect("app icon not found");
BASE_ICON
.set((icon.rgba().to_vec(), icon.width(), icon.height()))
.ok();
TrayIconBuilder::with_id("main-tray")
.icon(icon)
.tooltip("OmniGet")
.menu(&menu)
.on_menu_event(|app, event| match event.id().as_ref() {
"open" => show_window(app),
"quit" => {
request_quit(app);
}
other => {
if let Some(channel_id) = other.strip_prefix("chk:") {
let app = app.clone();
let channel_id = channel_id.to_string();View on GitHub (pinned to 8600b91f42)