Skip to content

Discord SafeGatewayPlugin crashes gateway on WebSocket close (maxReconnectAttempts=0 in v2026.3.24) #55301

Closed

Description

@aneym

Summary

The Discord SafeGatewayPlugin throws an uncaught exception when the Discord WebSocket closes with code 1005, crashing the entire gateway process. This happens because maxReconnectAttempts is 0 in the compiled v2026.3.24 dist, despite the source setting it to 50.

Reproduction

  1. Run [email protected] with Discord channel enabled
  2. Wait for Discord WebSocket to drop (close code 1005 — "no status received")
  3. Gateway crashes immediately with uncaught exception

Crash occurs repeatedly — gateway survives ~30-40 minutes between crashes.

Error

[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:20)
    at WebSocket.emitClose (ws/lib/websocket.js:273:10)
    at TLSSocket.socketOnClose (ws/lib/websocket.js:1346:15)

Two issues

  1. maxReconnectAttempts is 0 in dist — Source at src/discord/monitor/gateway-plugin.ts sets reconnect: { maxAttempts: 50 }, but the installed build uses 0. Either a build/bundling issue or an unintended override.

  2. Reconnect failure kills the process — Even with maxAttempts: 0, the error should be caught and the Discord channel gracefully degraded, not thrown as an uncaught exception that crashes the gateway. A single channel failure should never take down the entire process.

Workaround

Disable Discord channel in config: channels.discord.enabled: false

Environment

  • [email protected] (npm global install)
  • Node 25.8.1
  • macOS (launchd service)
  • @buape/carbon/gateway SafeGatewayPlugin

🤖 Generated with Claude Code

Activity

  1. Takhoffman commented on Mar 29, 2026

    @Takhoffman
    Contributor

    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.

  2. locked as resolved and limited conversation to collaborators on Apr 1, 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