Skip to content

Discord stale-socket recovery can crash entire gateway on 2026.3.24 #54667

Closed

Description

@rcritz

Summary

On OpenClaw 2026.3.24, the Discord provider can crash the entire gateway during a stale-socket recovery path.

What happens

The gateway health monitor detects a Discord stale socket, tries to restart the Discord provider, and then the whole gateway process exits with an uncaught exception instead of isolating the Discord failure.

Observed errors

From journalctl --user -u openclaw-gateway.service:

[health-monitor] [discord:default] health-monitor: restarting (reason: stale-socket)
[openclaw] Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005

Related Discord gateway logs seen around the same failures:

[discord] gateway was not ready after 15000ms; forcing a fresh reconnect
[discord] gateway: WebSocket connection closed with code 1005
[discord] gateway: Reconnecting with backoff: 1000ms after code 1005
[discord] gateway: WebSocket connection closed with code 1006
[discord] gateway error: Error: WebSocket was closed before the connection was established
[discord] gateway error: Error: Unexpected server response: 520

Then systemd reports the gateway process dying and restarting:

openclaw-gateway.service: Main process exited, code=exited, status=1/FAILURE
openclaw-gateway.service: Failed with result 'exit-code'.
openclaw-gateway.service: Scheduled restart job, restart counter is at 2.

Repro-ish timeline

This happened repeatedly on the same host on 2026.3.24:

  • 2026-03-25 19:13:51 UTC
  • 2026-03-25 19:49:00 UTC

Both times the sequence was essentially:

  1. Discord stale socket detected
  2. reconnect path hits Max reconnect attempts (0) reached after code 1005
  3. uncaught exception escapes
  4. entire gateway exits
  5. systemd restarts the gateway

Expected behavior

A Discord provider failure should not crash the entire OpenClaw gateway. The provider should degrade/restart in isolation, or at minimum fail closed without bringing down Telegram / other channels.

Environment

  • OpenClaw 2026.3.24
  • systemd user service
  • Linux x64
  • Discord configured but rarely used; Telegram is primary

Impact

Even when Discord is only enabled as a backup channel, it can introduce gateway instability and restart the main assistant.

Activity

  1. davidrobertson commented on Mar 25, 2026

    @davidrobertson

    I am running into this same issue. Crashes started after the .24 update.

    2026-03-25T15:51:06.446-04:00 [health-monitor] [discord:default] health-monitor: restarting (reason: stale-socket)
    2026-03-25T15:51:06.687-04:00 [openclaw] Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005
        at SafeGatewayPlugin.handleReconnectionAttempt (file:///app/node_modules/@buape/carbon/src/plugins/gateway/GatewayPlugin.ts:400:5)
        at SafeGatewayPlugin.handleClose (file:///app/node_modules/@buape/carbon/src/plugins/gateway/GatewayPlugin.ts:484:8)
        at WebSocket.<anonymous> (file:///app/node_modules/@buape/carbon/src/plugins/gateway/GatewayPlugin.ts:376:9)
        at WebSocket.emit (node:events:508:28)
        at WebSocket.emitClose (/app/node_modules/@buape/carbon/node_modules/ws/lib/websocket.js:273:10)
        at TLSSocket.socketOnClose (/app/node_modules/@buape/carbon/node_modules/ws/lib/websocket.js:1346:15)
        at TLSSocket.emit (node:events:520:35)
        at node:net:346:12
        at TCP.done (node:internal/tls/wrap:667:7)
    
  2. ForceConstant commented on Mar 25, 2026

    @ForceConstant
    Contributor

    Discord is having API issues today, but it shouldn't cause openclaw to crash.

  3. steipete commented on Mar 26, 2026

    @steipete
    Contributor

    Closing as a duplicate of #54894.

    This is the same Discord stale-socket or abort crash family also confirmed in #54931 and fixed by #55000:

    • the lifecycle abort path sets reconnect maxAttempts to 0
    • disconnect then emits a synchronous Max reconnect attempts (0) error
    • that error escapes before teardown unless the supervisor is detached first

    Keeping canonical tracking on #54894 and the fix discussion on #55000.

  4. locked as resolved and limited conversation to collaborators on Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions