Skip to content

Discord WebSocket crash: 'Max reconnect attempts (0) reached after code 1005' since 2026.3.24 #55421

Closed

Description

@apsntian

Summary

Since upgrading to 2026.3.24, the Discord provider crashes every ~35 minutes with an uncaught exception when the Discord gateway drops the WebSocket connection with code 1005 (No Status Received). Prior to this version (e.g. 2026.3.13), the same stale-socket event was handled gracefully without a crash.

Environment

  • OpenClaw version: 2026.3.24
  • Node version: v22.22.1 / v25.8.1
  • OS: macOS 26.3.1 (arm64)
  • Channel: Discord

Error

[openclaw] Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005
    at SafeGatewayPlugin.handleReconnectionAttempt (file:///opt/homebrew/lib/node_modules/openclaw/dist/provider-CAlWEl41.js:3318:47)
    at SafeGatewayPlugin.handleClose (file:///opt/homebrew/lib/node_modules/openclaw/dist/provider-CAlWEl41.js:3364:8)
    at WebSocket.<anonymous> (file:///opt/homebrew/lib/node_modules/openclaw/dist/provider-CAlWEl41.js:3307:9)
    at WebSocket.emit (node:events:519:28)
    at WebSocket.emitClose (/opt/homebrew/lib/node_modules/openclaw/node_modules/ws/lib/websocket.js:273:10)
    at TLSSocket.socketOnClose (/opt/homebrew/lib/node_modules/openclaw/node_modules/ws/lib/websocket.js:1346:15)

Frequency

Reproducible every ~35 minutes. The health-monitor detects the stale-socket and triggers a process restart, but instead of restarting gracefully, the process crashes first due to the uncaught exception, then LaunchAgent restarts it.

Log Timeline (2026-03-26 ~ 2026-03-27)

2026-03-26T18:41:36 [health-monitor] restarting (reason: stale-socket)
2026-03-26T18:41:36 [openclaw] Uncaught exception: Max reconnect attempts (0) reached after code 1005
2026-03-26T19:16:38 [health-monitor] restarting (reason: stale-socket)
2026-03-26T19:16:38 [openclaw] Uncaught exception: Max reconnect attempts (0) reached after code 1005
... (continues every ~35-90 minutes overnight)
2026-03-27T08:27:18 [health-monitor] restarting (reason: stale-socket)
2026-03-27T08:27:19 [openclaw] Uncaught exception: Max reconnect attempts (0) reached after code 1005

Before vs After

  • 2026.3.13 and earlier: stale-socket events triggered a graceful internal restart, no crash, no Uncaught exception
  • 2026.3.24: Same stale-socket event now causes an unhandled exception crash (code 1005)

The dist bundle name also changed between versions (subsystem-BDbeCphF.js → env-D1ktUnAV.js), suggesting significant refactoring in the Discord provider reconnection logic.

Expected Behavior

Discord WebSocket disconnections (code 1005) should be handled gracefully with reconnection or clean restart — not as an uncaught exception that crashes the process.

Activity

  1. added a commit that references this issue on Mar 27, 2026
    a058b37
  2. vincentkoc commented on Mar 27, 2026

    @vincentkoc
    Member

    Thanks for the report.

    Closing as duplicate of #55403.

    This is the same queued reconnect-exhausted / code 1005 stale-socket crash path, and the current fix is in #55991 against latest main.

  3. locked as resolved and limited conversation to collaborators on Mar 30, 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