You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Discord gateway crashes on WebSocket close during lifecycle abort (maxAttempts=0 race condition) #55097
When the Discord gateway's abort signal fires (e.g., during lifecycle management), onAbort() sets gateway.options.reconnect = { maxAttempts: 0 } and then calls gateway.disconnect(). However, if a WebSocket close event (code 1005) is received during or shortly after this, handleReconnectionAttempt sees maxAttempts=0, emits an error event, which becomes an uncaught exception and crashes the entire gateway process.
Stack Trace
[openclaw] Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005
at SafeGatewayPlugin.handleReconnectionAttempt (provider-CAlWEl41.js:3318:47)
at SafeGatewayPlugin.handleClose (provider-CAlWEl41.js:3364:8)
at WebSocket.<anonymous> (provider-CAlWEl41.js:3307:9)
at WebSocket.emit (node:events:508:28)
at WebSocket.emitClose (ws/lib/websocket.js:273:10)
at TLSSocket.socketOnClose (ws/lib/websocket.js:1346:15)
This bug causes the entire openclaw gateway to crash repeatedly whenever Discord WebSocket connections are interrupted during lifecycle transitions. The gateway must be manually restarted each time.
Activity
steipete commentedon Mar 26, 2026
Closing as a duplicate of #54894.
This matches the same Discord reconnect or abort crash path tracked in #54931 and fixed by PR #55000:
Keeping the canonical tracking on #54894 plus the fix discussion on #55000.