LGUG2Z/komorebi · error

could not send message on winevent_listener::event_tx

Error message

could not send message on winevent_listener::event_tx

What it means

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.

Source

Thrown at komorebi/src/windows_callbacks.rs:149

    let event_type = match WindowManagerEvent::from_win_event(winevent, window) {
        None => {
            tracing::trace!(
                "Unhandled WinEvent: {winevent} (hwnd: {}, exe: {}, title: {}, class: {})",
                window.hwnd,
                window.exe().unwrap_or_default(),
                window.title().unwrap_or_default(),
                window.class().unwrap_or_default()
            );

            return;
        }
        Some(event) => event,
    };

    winevent_listener::event_tx()
        .send(event_type)
        .expect("could not send message on winevent_listener::event_tx");
}

View on GitHub (pinned to e0709f02bf)

Solutions

  1. Restart komorebi so the winevent listener thread and channel are recreated
  2. Check komorebi.log for an earlier panic on the listener thread that dropped the receiver
  3. Upgrade komorebi if listener-thread panics on certain events are fixed upstream
  4. Handle send failure gracefully (log and drop the event) instead of panicking in the Win32 callback

Example fix

// before
winevent_listener::event_tx().send(event_type).expect("could not send message on winevent_listener::event_tx");
// after
if let Err(e) = winevent_listener::event_tx().send(event_type) {
    tracing::error!("could not send message on winevent_listener::event_tx: {e}");
}
Defensive patterns

Strategy: try-catch

Try / catch

if let Err(e) = winevent_listener::event_tx().send(event_type) {
    tracing::error!("winevent listener gone: {e}; event dropped");
}

Prevention

When it happens

Trigger: 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.

Common situations: komorebi shutting down while WinEventProc callbacks still fire; the listener thread crashing earlier due to another error; session teardown (logoff/lock) dropping the channel.

Related errors


AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06). Data as JSON: /api/errors/bd259cf216c500c5. Report an issue: GitHub.