{"record":{"id":"8b020420f0c32af8","repo":"LGUG2Z/komorebi","slug":"could-not-start-winput-message-loop","errorCode":null,"errorMessage":"could not start winput message loop","messagePattern":"could not start winput message loop","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"komorebi/src/process_movement.rs","lineNumber":17,"sourceCode":"use std::sync::Arc;\n\nuse parking_lot::Mutex;\nuse winput::Action;\nuse winput::message_loop;\nuse winput::message_loop::Event;\n\nuse crate::core::FocusFollowsMouseImplementation;\n\nuse crate::window_manager::WindowManager;\n\n#[tracing::instrument]\npub fn listen_for_movements(wm: Arc<Mutex<WindowManager>>) {\n    std::thread::spawn(move || {\n        let mut ignore_movement = false;\n\n        let receiver = message_loop::start().expect(\"could not start winput message loop\");\n\n        loop {\n            let focus_follows_mouse = wm.lock().focus_follows_mouse;\n            if matches!(\n                focus_follows_mouse,\n                Some(FocusFollowsMouseImplementation::Komorebi)\n            ) {\n                match receiver.next_event() {\n                    // Don't want to send any raise events while we are dragging or resizing\n                    Event::MouseButton { action, .. } => match action {\n                        Action::Press => ignore_movement = true,\n                        Action::Release => ignore_movement = false,\n                    },\n                    Event::MouseMoveRelative { .. } if !ignore_movement => {\n                        match wm.lock().raise_window_at_cursor_pos() {\n                            Ok(()) => {}\n                            Err(error) => tracing::error!(\"{}\", error),\n                        }","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebi/src/process_movement.rs#L1-L35","documentation":"listen_for_movements starts the winput Windows message loop (used for focus-follows-mouse) in a spawned thread and panics if message_loop::start() fails. The winput library requires a runnable Win32 message pump in the calling thread; failure indicates a Windows API error creating the message window.","triggerScenarios":"message_loop::start() returning Err when the Win32 message queue/window cannot be created — e.g. running in a non-interactive session (service, SSH, session 0).","commonSituations":"Launching komorebi from a scheduled task or service without an interactive desktop; remote sessions without UI access; corrupted Windows user session.","solutions":["Run komorebi from an interactive user session (normal login), not a service or SSH session","Ensure komorebi autostarts via the user's startup folder/registry Run key","Reboot/re-login to fix a broken Win32 session","Verify komorebi version matches your Windows build; upgrade komorebi if winput failures persist"],"exampleFix":"// before\nlet receiver = message_loop::start().expect(\"could not start winput message loop\");\n// after\nlet receiver = match message_loop::start() {\n    Ok(r) => r,\n    Err(e) => { tracing::error!(\"could not start winput message loop: {e}\"); return; }\n};","handlingStrategy":"validation","validationCode":"// before launching komorebi, confirm an interactive desktop session exists (PowerShell)\nif ([System.Windows.Forms.SystemInformation]::Interactive) { start komorebi } else { throw \"no interactive session\" }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never run komorebi as a Windows service or in an SSH/non-interactive session","Autostart via the user's Run key or Startup folder only","Re-login if Win32 message queues appear broken"],"tags":["windows","win32","panic","input"],"backgroundTag":"module-init-failed","analyzedSha":"e0709f02bfae4e503bf4640f58ee75ecbbfdbb97","analyzedAt":"2026-09-06T07:08:05.107Z","contentChangedAt":"2026-09-06T07:08:05.107Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}