{"record":{"id":"74b56320b6d09906","repo":"ramensoftware/windhawk","slug":"error-while-running-the-windhawk-ui","errorCode":null,"errorMessage":"error while running the Windhawk UI","messagePattern":"error while running the Windhawk UI","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/windhawk-core/ui/src/lib.rs","lineNumber":775,"sourceCode":"                    // and the background catalog refresh.\n                    pump::profile_watch::spawn(background_ctx.clone());\n                    pump::startup::kick(&background_ctx);\n                })\n                .expect(\"spawn the background startup thread\");\n\n            Ok(())\n        })\n        .invoke_handler(tauri::generate_handler![\n            wh_ipc,\n            wh_log_backlog,\n            wh_log_stop_capture,\n            broker::wh_broker_state,\n            broker::wh_broker_retry,\n            splash::wh_splash_ready,\n            splash::wh_splash_presented\n        ])\n        .run(tauri::generate_context!())\n        .expect(\"error while running the Windhawk UI\");\n}\n\n/// The stored UI theme setting, read from `getAppSettings` once at startup to seed the\n/// native shell before the window opens. A read failure is the dark default (as is any\n/// unrecognized value, per `ThemeSetting::parse`), matching the core's stored default and\n/// the front-end.\nfn startup_theme_setting(session: &dyn SessionApi) -> ThemeSetting {\n    match session.invoke_as::<AppSettings, _>(\"getAppSettings\", &json!({})) {\n        Ok(settings) => ThemeSetting::parse(&settings.theme),\n        Err(_) => ThemeSetting::Dark,\n    }\n}\n\n/// Present a fatal failure as a native modal box, then terminate. Used where\n/// there is no webview to render a reply into - which is every case here, since\n/// what has failed is the window itself. `lead` is the sentence the box opens\n/// with; `detail` is the explanation that follows it. Whatever the collectors\n/// hold goes behind the box's expander, so the message stays a message and the","sourceCodeStart":757,"sourceCodeEnd":793,"githubUrl":"https://github.com/ramensoftware/windhawk/blob/61d99ed8e182e1af1b60109612b6763ad1b4b74e/src/windhawk-core/ui/src/lib.rs#L757-L793","documentation":"Rust Tauri application bootstrap in windhawk-core's ui::run. After building the Tauri app with the event system (broker state, splash readiness/presentation), .run(...) is unwrapped with .expect; if the Tauri runtime fails to start or the event loop errors, the process panics with 'error while running the Windhawk UI'.","triggerScenarios":"tauri::Builder::run returns Err — typically a duplicate app instance / single-instance lock, invalid tauri.conf.json context, window creation failure, or plugin initialization error.","commonSituations":"Another Windhawk UI instance already holding the single-instance lock; corrupted or mismatched tauri.conf.json at build time; missing webview runtime (WebView2) on the machine.","solutions":["Check whether another Windhawk UI instance is already running (single-instance lock) and close it.","Verify tauri.conf.json is valid and that tauri::generate_context! matches the configured assets/icons.","Ensure the WebView2 runtime (or platform webview dependency) is installed and up to date, then relaunch."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Before launching the UI process:\nif (single_instance_lock_held()) {\n    eprintln!(\"Windhawk UI already running\");\n    std::process::exit(0);\n}\n// And ensure webview runtime present before run().","typeGuard":null,"tryCatchPattern":"if let Err(e) = tauri::Builder::default()\n    .manage(/* ... */)\n    .run(tauri::generate_context!())\n{\n    eprintln!(\"error while running the Windhawk UI: {e:#?}\");\n    std::process::exit(1);\n}","preventionTips":["Replace .expect with if-let Err handling so failures log a reason instead of a bare panic.","Check for an already-running instance before startup (single-instance guard).","Validate tauri.conf.json and WebView2 runtime availability in installer/pre-launch checks."],"tags":["tauri","app-startup","panic","rust"],"backgroundTag":"module-init-failed","analyzedSha":"61d99ed8e182e1af1b60109612b6763ad1b4b74e","analyzedAt":"2026-09-12T14:02:41.115Z","contentChangedAt":"2026-09-12T14:02:41.115Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}