{"record":{"id":"bb3c2a3784029904","repo":"glzr-io/glazewm","slug":"failed-to-send-event","errorCode":null,"errorMessage":"Failed to send event: {}","messagePattern":"Failed to send event: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/wm/src/ipc_server.rs","lineNumber":395,"sourceCode":"      WmEvent::WindowUnmanaged { .. } => {\r\n        SubscribableEvent::WindowUnmanaged\r\n      }\r\n      WmEvent::WorkspaceActivated { .. } => {\r\n        SubscribableEvent::WorkspaceActivated\r\n      }\r\n      WmEvent::WorkspaceDeactivated { .. } => {\r\n        SubscribableEvent::WorkspaceDeactivated\r\n      }\r\n      WmEvent::WorkspaceUpdated { .. } => {\r\n        SubscribableEvent::WorkspaceUpdated\r\n      }\r\n      WmEvent::PauseChanged { .. } => SubscribableEvent::PauseChanged,\r\n    };\r\n\r\n    self\r\n      .event_tx\r\n      .send((event_type, event))\r\n      .map_err(|err| anyhow::anyhow!(\"Failed to send event: {}\", err))?;\r\n\r\n    Ok(())\r\n  }\r\n\r\n  pub fn stop(&self) {\r\n    info!(\"Shutting down IPC server.\");\r\n    self.abort_handle.abort();\r\n  }\r\n}\r\n\r\nimpl Drop for IpcServer {\r\n  fn drop(&mut self) {\r\n    self.stop();\r\n  }\r\n}\r\n","sourceCodeStart":377,"sourceCodeEnd":411,"githubUrl":"https://github.com/glzr-io/glazewm/blob/5709ad0a3c7c386bbc3e38166a865ffc12937515/packages/wm/src/ipc_server.rs#L377-L411","documentation":"`IpcServer::process_event` forwards a `WmEvent` to subscribers through the `event_tx` channel. A send failure means no active receiver exists — all event subscribers disconnected or the channel was closed during shutdown. The event is lost and this error records why.","triggerScenarios":"Emitting a WM event when the last event subscriber has disconnected (e.g. `glazewm command subscribe` client closed), or during server shutdown while event processing is still running.","commonSituations":"Status-bar/automation clients (e.g. widgets, scripts using wm-ipc-client) exiting without unsubscribing while the WM keeps emitting events; transient race at application exit.","solutions":["Confirm an event subscriber is actually connected before/while expecting events (e.g. keep the IPC client alive).","In emitting code, use a fallible or lenient send and log at debug level when there are no subscribers, if this occurs during normal teardown.","Restart the subscriber and re-subscribe to the events you need.","If seen repeatedly at shutdown, ensure `IpcServer::stop()` runs before final event emissions.","Check client logs for disconnects (network issues, crashes) causing dropped subscriptions."],"exampleFix":"// before\nself.event_tx.send((event_type, event)).map_err(|err| anyhow::anyhow!(\"Failed to send event: {}\", err))?;\n// after\nif let Err(err) = self.event_tx.send((event_type, event)) {\n  tracing::debug!(\"No active event subscriber; dropping event: {}\", err);\n}","handlingStrategy":"retry","validationCode":"fn has_event_subscribers(server: &IpcServer) -> bool { server.subscriber_count() > 0 }","typeGuard":null,"tryCatchPattern":"if let Err(e) = server.process_event(state, event) {\n  tracing::debug!(\"Event not delivered (no subscribers or shutting down): {e}\");\n}","preventionTips":["Keep subscriber clients alive for the duration you need events.","Re-subscribe after client restarts.","Gracefully shut down the IPC server before final event emissions."],"tags":["rust","ipc","events","channel"],"backgroundTag":"broken-pipe","analyzedSha":"5709ad0a3c7c386bbc3e38166a865ffc12937515","analyzedAt":"2026-09-08T03:26:40.288Z","contentChangedAt":"2026-09-08T03:26:40.288Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}