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
[Bug]: Uncaught exception on Discord stale-socket reconnection causes full gateway crash loop #55274
When the health monitor detects a stale-socket on the Discord channel and triggers a reconnect, the Carbon Discord library throws an uncaught exception that kills the entire gateway process. The gateway restarts automatically but the cycle repeats approximately every 35 minutes.
Steps to reproduce
Run OpenClaw with a Discord channel configured
Wait for the Discord WebSocket to go stale (code 1006)
Health monitor fires stale-socket restart
Gateway crashes
Expected behavior
The Discord provider should recover gracefully from a stale socket without crashing the entire gateway process. The uncaught exception should be caught and handled internally.
Actual behavior
Full process crash. Restarts in ~7 seconds. Repeats every ~35 minutes. After enough cycles, memory accumulates to ~4GB and an OOM crash occurs on top of the reconnect crashes.
OpenClaw version
2026.3.24
Operating system
Linux 6.8.0 x64
Install method
Docker
Model
anthropic/claude-sonnet-4.6
Provider / routing chain
openclaw -> anthropic
Additional provider/model setup details
The crash loop appears to have started around process startup — not triggered by any config change
The OOM (Reached heap limit - JavaScript heap out of memory) appears to be a downstream effect of the crash/restart accumulation, not an independent memory leak
Gateway recovers fine on each restart; the issue is the crash itself and the memory growth over time
Logs, screenshots, and evidence
[health-monitor] [discord:default] health-monitor: restarting (reason: stale-socket)
Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005
at SafeGatewayPlugin.handleReconnectionAttempt (GatewayPlugin.ts:400:5)
at SafeGatewayPlugin.handleClose (GatewayPlugin.ts:484:8)
at WebSocket.<anonymous> (GatewayPlugin.ts:376:9)
Experiencing this exact crash loop since upgrading to 2026.3.24. Gateway crashes every ~35 minutes when Discord WebSocket goes stale. Restart counter climbs from 1 to 6+ before eventually stabilizing.
Log excerpt:
[health-monitor] [discord:sara] health-monitor: restarting (reason: stale-socket)
Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005
systemd: Scheduled restart job, restart counter is at N.
Affected both Discord accounts. Confirmed on WSL2 + systemd.
Fix tracked in #55324. Root cause: gatewaySupervisor.dispose() removes the error listener before Carbon finishes emitting, causing Node's EventEmitter to throw the late reconnect-exhausted as an uncaught exception. Fix keeps the listener attached (handler is already a no-op after dispose) and suppresses the expected error during intentional shutdown.
Closing as fixed upstream. This crash family was addressed by upstream Discord lifecycle changes merged in #55991, and PR #55000 was closed after the upstream maintainer confirmed the fix landed there.
If you still hit the same Max reconnect attempts (0) / stale-socket gateway crash on the latest OpenClaw release, comment here with fresh logs and version details and we can reopen or spin a new issue.
Activity
Crabsticksalad commentedon Mar 26, 2026
Experiencing this exact crash loop since upgrading to 2026.3.24. Gateway crashes every ~35 minutes when Discord WebSocket goes stale. Restart counter climbs from 1 to 6+ before eventually stabilizing.
Log excerpt:
Affected both Discord accounts. Confirmed on WSL2 + systemd.
joelnishanth commentedon Mar 26, 2026
Working on a fix for this. Will have a PR up shortly.
— Joel Nishanth · offlyn.AI
joelnishanth commentedon Mar 26, 2026
Fix tracked in #55324. Root cause:
gatewaySupervisor.dispose()removes the error listener before Carbon finishes emitting, causing Node's EventEmitter to throw the latereconnect-exhaustedas an uncaught exception. Fix keeps the listener attached (handler is already a no-op after dispose) and suppresses the expected error during intentional shutdown.— Joel Nishanth · offlyn.AI
Takhoffman commentedon Mar 29, 2026
Closing as fixed upstream. This crash family was addressed by upstream Discord lifecycle changes merged in #55991, and PR #55000 was closed after the upstream maintainer confirmed the fix landed there.
If you still hit the same
Max reconnect attempts (0)/ stale-socket gateway crash on the latest OpenClaw release, comment here with fresh logs and version details and we can reopen or spin a new issue.