{"record":{"id":"c41adba795153cc3","repo":"DioxusLabs/dioxus","slug":"tray-icon-builder-failed","errorCode":null,"errorMessage":"tray icon builder failed","messagePattern":"tray icon builder failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/desktop/src/trayicon.rs","lineNumber":45,"sourceCode":"#[allow(unused)]\npub fn init_tray_icon(menu: DioxusTrayMenu, icon: Option<DioxusTrayIcon>) -> DioxusTray {\n    #[cfg(any(target_os = \"windows\", target_os = \"linux\", target_os = \"macos\"))]\n    {\n        let icon = icon.map(Ok).unwrap_or_else(crate::default_icon);\n\n        let tray = tray_icon::TrayIconBuilder::new()\n            .with_menu(Box::new(menu))\n            .with_menu_on_left_click(false);\n\n        let tray = match icon {\n            Ok(icon) => tray.with_icon(icon),\n            Err(err) => {\n                tracing::trace!(\"No tray icon: {:?}\", err);\n                tray\n            }\n        };\n\n        provide_context(tray.build().expect(\"tray icon builder failed\"))\n    }\n}\n\n/// Returns a default tray icon menu\npub fn default_tray_icon() -> DioxusTrayMenu {\n    #[cfg(any(target_os = \"windows\", target_os = \"linux\", target_os = \"macos\"))]\n    {\n        use tray_icon::menu::{Menu, PredefinedMenuItem};\n        let tray_menu = Menu::new();\n        tray_menu\n            .append_items(&[&PredefinedMenuItem::quit(None)])\n            .unwrap();\n        tray_menu\n    }\n}\n\n/// Provides a hook to the tray icon\n#[cfg(any(target_os = \"windows\", target_os = \"linux\", target_os = \"macos\"))]","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/desktop/src/trayicon.rs#L27-L63","documentation":"`init_tray_icon` builds the system tray icon with `tray_icon::TrayIconBuilder` and `expect`s the builder to succeed. This panic fires when the OS tray API rejects the icon/menu setup (e.g. unsupported platform state or invalid icon data); failures are considered unrecoverable for tray support.","triggerScenarios":"Thrown at packages/desktop/src/trayicon.rs:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the tray icon configuration (icon data, size, platform support); the underlying tray icon builder rejected the provided values."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}