Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't working
Description
Bug Description
Discord WebSocket connections that die overnight enter an infinite reconnect loop that crashes the entire gateway process, taking down all other channels (Telegram, etc.) with it.
Environment
- OpenClaw version: 2026.2.9
- Discord dependency: @buape/carbon 0.14.0
- Platform: macOS (Mac Mini, always-on)
- Node.js: 25.5.0
Reproduction
- Run gateway with Discord enabled (2 bot accounts)
- Wait for overnight network disruption or Discord-side WebSocket close
- Gateway enters reconnect death spiral
Observed Behavior
The Discord WebSocket connection dies (code 1005/1006) but the reconnect logic doesn't back off properly:
[discord] gateway: WebSocket connection closed with code 1005
[discord] gateway: Attempting resume with backoff: 1000ms
[discord] connection stalled: no HELLO received within 30000ms, forcing reconnect
[discord] gateway: Attempting resume with backoff: 1000ms
[discord] gateway: WebSocket connection closed with code 1006
[discord] gateway: WebSocket connection closed with code 1006
[discord] gateway: WebSocket connection closed with code 1005
[discord] gateway: Attempting resume with backoff: 1000ms
[discord] gateway: WebSocket connection closed with code 1005
In one session: 1,496 WebSocket closes and 1,301 resume attempts before manual intervention.
The uncaught exceptions from the zombie connection cause full gateway restarts. Each restart re-triggers the same dead connection, creating a crash loop. During this time:
- Telegram polling times out repeatedly (500s timeouts, backoff up to 30s)
- LLM requests on the main lane time out (298s+)
- The system is effectively unusable
Expected Behavior
- Exponential backoff on Discord reconnects (not fixed 1000ms)
- Circuit breaker: after N failed reconnects, disable Discord channel gracefully without crashing the gateway
- Zombie connection errors should be caught and handled, not thrown as uncaught exceptions
- Other channels (Telegram, Slack) should not be affected by Discord connection issues
Related
- PR Gateway stability (WhatsApp-only, Discord optional, EPIPE/4014 handling) + token, status, WhatsApp UX #5564 addresses some of this (EPIPE/4014 handling) but the zombie reconnect loop still occurs
- Issue Discord: Messages lost when bot takes >2 min to respond (Slow listener timeout) #4864 (slow listener timeout) may be related
- Issue [Bug]: Discord bot stuck in infinite retry loop when image exceeds 5MB limit - oversized image remains in session history #11180 (infinite retry loop) is a similar pattern with different trigger
Workaround
Currently disabling Discord via config and restarting the gateway when the loop is detected. Running a health monitor script that watches logs and auto-recovers.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Type
Fields
Priority
None yet
Activity
sebslight commentedon Feb 13, 2026
Closing as duplicate of #14331. If this is incorrect, comment and we can reopen.