Repository navigation
Description
Bug type
Crash (process/app exits or hangs)
Beta release blocker
No
Summary
Summary
When the Discord channel socket goes stale, OpenClaw's health monitor attempts to recover it, but the Discord reconnect path throws an uncaught exception and crashes the entire gateway process.
Version / Environment
- OpenClaw:
2026.3.24 - Channel:
stable - Install:
pnpm - OS: Windows 10.0.26200
- Gateway mode: local
- Gateway bind: loopback
- Discord: enabled
- Telegram: enabled
openclaw update status reports the install is already up to date on stable.
Observed behavior
The gateway runs normally until Discord hits a stale socket condition.
Then logs show:
health-monitor: restarting (reason: stale-socket)Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005
After that, the gateway process dies and is restarted externally by the Windows scheduled task.
Expected behavior
A stale Discord socket should be recoverable and should not crash the entire gateway process.
At worst:
- Discord should reconnect or fail its own channel runtime cleanly
- the gateway should stay alive
- channel restart failures should be contained, not become uncaught process-level exceptions
Why this seems like a bug
I checked local config and did not find any Discord reconnect setting that would set max attempts to 0.
I also inspected the installed bundle and found what appears to be a nonzero reconnect configuration in the Discord gateway plugin path, including:
reconnect: { maxAttempts: 50 }
But at runtime the thrown error is:
Max reconnect attempts (0) reached after code 1005
So it looks like either:
- the reconnect options are being lost before they reach the Discord gateway client, or
- a stale-socket / restart path is constructing the reconnect handler incorrectly
Relevant log lines
[discord:default] health-monitor: restarting (reason: stale-socket)
Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005
at SafeGatewayPlugin.handleReconnectionAttempt (...)
at SafeGatewayPlugin.handleClose (...)
### Steps to reproduce
## Summary
When the Discord channel socket goes stale, OpenClaw's health monitor attempts to recover it, but the Discord reconnect path throws an uncaught exception and crashes the entire gateway process.
## Version / Environment
- OpenClaw: `2026.3.24`
- Channel: `stable`
- Install: `pnpm`
- OS: Windows 10.0.26200
- Gateway mode: local
- Gateway bind: loopback
- Discord: enabled
- Telegram: enabled
`openclaw update status` reports the install is already up to date on stable.
## Observed behavior
The gateway runs normally until Discord hits a stale socket condition.
Then logs show:
- `health-monitor: restarting (reason: stale-socket)`
- `Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005`
After that, the gateway process dies and is restarted externally by the Windows scheduled task.
## Expected behavior
A stale Discord socket should be recoverable and should not crash the entire gateway process.
At worst:
- Discord should reconnect or fail its own channel runtime cleanly
- the gateway should stay alive
- channel restart failures should be contained, not become uncaught process-level exceptions
## Why this seems like a bug
I checked local config and did not find any Discord reconnect setting that would set max attempts to `0`.
I also inspected the installed bundle and found what appears to be a nonzero reconnect configuration in the Discord gateway plugin path, including:
- `reconnect: { maxAttempts: 50 }`
But at runtime the thrown error is:
- `Max reconnect attempts (0) reached after code 1005`
So it looks like either:
1. the reconnect options are being lost before they reach the Discord gateway client, or
2. a stale-socket / restart path is constructing the reconnect handler incorrectly
## Relevant log lines
```text
[discord:default] health-monitor: restarting (reason: stale-socket)
Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005
at SafeGatewayPlugin.handleReconnectionAttempt (...)
at SafeGatewayPlugin.handleClose (...)
### Expected behavior
stay signed into discord
### Actual behavior
bad socket causes an error and closes the entire openclaw gateway
### OpenClaw version
OpenClaw version: **2026.3.24** Also: - Channel: **stable** - Install: **pnpm**
### Operating system
windows 11
### Install method
_No response_
### Model
openai-codex/gpt-5.4
### Provider / routing chain
openclaw-control-ui -> local OpenClaw gateway (ws://127.0.0.1:18789) -> Discord provider -> Discord gateway WebSocket
### Additional provider/model setup details
_No response_
### Logs, screenshots, and evidence
```shell
Impact and severity
No response
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
joelnishanth commentedon Mar 26, 2026
This is a duplicate of #55274. Fix tracked in #55324 — root cause is that
gatewaySupervisor.dispose()removes the error listener before Carbon finishes emitting the reconnect-exhausted event, causing an uncaught exception.— 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.buttheadus commentedon Mar 29, 2026
Works great now, thanks.