diegosouzapw/OmniRoute · error · Error
WebSocket not open
Error message
WebSocket not open
What it means
State guard reached via sendSockJS: the underlying SockJS WebSocket is not in the OPEN state when a STOMP frame is written. The session's socket dropped (or connect() never completed after init), so frames cannot be delivered; callers hit this after a silent disconnect or a race between connect and first send.
Solutions
- Reset the AmeliaClient session (null out session/ws) so the next call re-inits and reconnects
- Reconnect with backoff before retrying the send
- Check for idle-timeout disconnects and add heartbeat/keep-alive on long-lived sessions
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at open-sse/executors/chipotle.ts:256 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/e02b9f0d9eb3b853.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/executors/chipotle.ts:256
this.sendSockJS(this.buildStompSend("/app/send", payload));
});
}
private buildStompConnect(): string {
return `CONNECT\naccept-version:1.1,1.0\nheart-beat:0,0\nX-CSRF-TOKEN:${this.session!.csrfToken}\n\n\0`;
}
private buildStompSubscribe(destination: string, id: string): string {
return `SUBSCRIBE\ndestination:${destination}\nid:${id}\n\n\0`;
}
private buildStompSend(destination: string, body: string): string {
return `SEND\ndestination:${destination}\ncontent-type:application/json\ncontent-length:${Buffer.byteLength(body)}\n\n${body}\0`;
}
private sendSockJS(stompFrame: string): void {
if (!this.ws || this.ws.readyState !== 1) {
throw new Error("WebSocket not open");
}
this.ws.send(JSON.stringify([stompFrame]));
}
async close(): Promise<void> {
if (this.ws) {
this.ws.close();
this.ws = null;
}
this.stompConnected = false;
this.session = null;
}
}
// ── Client pool ──────────────────────────────────────────────────────────
const POOL_MAX = 5;
const pool: AmeliaClient[] = [];View on GitHub (pinned to a179ffed5b)