{"record":{"id":"bd259cf216c500c5","repo":"LGUG2Z/komorebi","slug":"could-not-send-message-on-winevent-listener-event","errorCode":null,"errorMessage":"could not send message on winevent_listener::event_tx","messagePattern":"could not send message on winevent_listener::event_tx","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"komorebi/src/windows_callbacks.rs","lineNumber":149,"sourceCode":"\n    let event_type = match WindowManagerEvent::from_win_event(winevent, window) {\n        None => {\n            tracing::trace!(\n                \"Unhandled WinEvent: {winevent} (hwnd: {}, exe: {}, title: {}, class: {})\",\n                window.hwnd,\n                window.exe().unwrap_or_default(),\n                window.title().unwrap_or_default(),\n                window.class().unwrap_or_default()\n            );\n\n            return;\n        }\n        Some(event) => event,\n    };\n\n    winevent_listener::event_tx()\n        .send(event_type)\n        .expect(\"could not send message on winevent_listener::event_tx\");\n}\n","sourceCodeStart":131,"sourceCodeEnd":151,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebi/src/windows_callbacks.rs#L131-L151","documentation":"win_event_hook receives WinEventProc callbacks for window events and forwards them over winevent_listener::event_tx(), panicking if the bounded channel's send fails. Send fails only when the receiver has been dropped — i.e. the winevent listener thread has exited — so events can no longer be delivered.","triggerScenarios":"A Win32 window event fires after the winevent_listener receiver thread has terminated (listener thread panicked or was torn down), making event_tx().send() return Err.","commonSituations":"komorebi shutting down while WinEventProc callbacks still fire; the listener thread crashing earlier due to another error; session teardown (logoff/lock) dropping the channel.","solutions":["Restart komorebi so the winevent listener thread and channel are recreated","Check komorebi.log for an earlier panic on the listener thread that dropped the receiver","Upgrade komorebi if listener-thread panics on certain events are fixed upstream","Handle send failure gracefully (log and drop the event) instead of panicking in the Win32 callback"],"exampleFix":"// before\nwinevent_listener::event_tx().send(event_type).expect(\"could not send message on winevent_listener::event_tx\");\n// after\nif let Err(e) = winevent_listener::event_tx().send(event_type) {\n    tracing::error!(\"could not send message on winevent_listener::event_tx: {e}\");\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = winevent_listener::event_tx().send(event_type) {\n    tracing::error!(\"winevent listener gone: {e}; event dropped\");\n}","preventionTips":["Watch komorebi.log for listener-thread panics that drop the channel receiver","Restart komorebi after session lock/logoff oddities","Keep komorebi updated so listener-thread crash bugs are patched"],"tags":["windows","win32","channel","panic"],"backgroundTag":"channel-closed","analyzedSha":"e0709f02bfae4e503bf4640f58ee75ecbbfdbb97","analyzedAt":"2026-09-06T07:08:05.107Z","contentChangedAt":"2026-09-06T07:08:05.107Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}