glzr-io/glazewm · warning

Failed to send event

Error message

Failed to send event: {}

What it means

`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.

Solutions

  1. Confirm an event subscriber is actually connected before/while expecting events (e.g. keep the IPC client alive).
  2. 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.
  3. Restart the subscriber and re-subscribe to the events you need.
  4. If seen repeatedly at shutdown, ensure `IpcServer::stop()` runs before final event emissions.
  5. Check client logs for disconnects (network issues, crashes) causing dropped subscriptions.

Example fix

// before
self.event_tx.send((event_type, event)).map_err(|err| anyhow::anyhow!("Failed to send event: {}", err))?;
// after
if let Err(err) = self.event_tx.send((event_type, event)) {
  tracing::debug!("No active event subscriber; dropping event: {}", err);
}
Defensive patterns

Strategy: retry

Validate before calling

fn has_event_subscribers(server: &IpcServer) -> bool { server.subscriber_count() > 0 }

Try / catch

if let Err(e) = server.process_event(state, event) {
  tracing::debug!("Event not delivered (no subscribers or shutting down): {e}");
}

Prevention

When it happens

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

Common situations: 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.

Related errors


AI-assisted analysis of glzr-io/glazewm@5709ad0a3c (2026-09-08). Data as JSON: /api/errors/bb3c2a3784029904. Report an issue: GitHub.

Appendix: source

Thrown at packages/wm/src/ipc_server.rs:395

      WmEvent::WindowUnmanaged { .. } => {
        SubscribableEvent::WindowUnmanaged
      }
      WmEvent::WorkspaceActivated { .. } => {
        SubscribableEvent::WorkspaceActivated
      }
      WmEvent::WorkspaceDeactivated { .. } => {
        SubscribableEvent::WorkspaceDeactivated
      }
      WmEvent::WorkspaceUpdated { .. } => {
        SubscribableEvent::WorkspaceUpdated
      }
      WmEvent::PauseChanged { .. } => SubscribableEvent::PauseChanged,
    };

    self
      .event_tx
      .send((event_type, event))
      .map_err(|err| anyhow::anyhow!("Failed to send event: {}", err))?;

    Ok(())
  }

  pub fn stop(&self) {
    info!("Shutting down IPC server.");
    self.abort_handle.abort();
  }
}

impl Drop for IpcServer {
  fn drop(&mut self) {
    self.stop();
  }
}

View on GitHub (pinned to 5709ad0a3c)