openclaw - 💡(How to fix) Fix Feishu WebSocket reconnect exhausted causes permanent connection freeze [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#72828Fetched 2026-04-28 06:31:49
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Error Message

wsClient.start({ eventDispatcher, onError: (err) => { cleanup(); reject(err); // triggers reconnection at a higher level } });

Root Cause

Root Cause (traced to source)

Fix Action

Fix / Workaround

// Current code (no onError handler):
wsClient.start({ eventDispatcher });

```js
wsClient.start({
  eventDispatcher,
  onError: (err) => {
    cleanup();
    reject(err); // triggers reconnection at a higher level
  }
});

Code Example

// Current code (no onError handler):
wsClient.start({ eventDispatcher });

// Log evidence:
[ws] reconnect
ws: unable to connect to the server after trying 1 times
// → after this, no more WebSocket activity until Gateway restart

---

wsClient.start({
  eventDispatcher,
  onError: (err) => {
    cleanup();
    reject(err); // triggers reconnection at a higher level
  }
});
RAW_BUFFERClick to expand / collapse

Bug Report

Version: OpenClaw 2026.4.24 (cbcfdf6) OS: macOS Darwin 25.3.0 (arm64)

Symptom

Feishu WebSocket disconnects every 30-40 minutes and never auto-recovers. Only a Gateway restart restores the connection.

Root Cause (traced to source)

  1. Feishu server sends reconnectCount=1 in the pong config
  2. @larksuiteoapi/node-sdk exhausts reconnect attempts (1 try) and fires onError
  3. monitorWebSocket()\ in monitor.account-BSdTHVBX.jsdoes **not** handle theonErrorevent fromwsClient.start()`
  4. The Promise never resolves or rejects → connection is permanently frozen
// Current code (no onError handler):
wsClient.start({ eventDispatcher });

// Log evidence:
[ws] reconnect
ws: unable to connect to the server after trying 1 times
// → after this, no more WebSocket activity until Gateway restart

Fix Suggestion

Pass an onError callback to wsClient.start() that rejects the Promise, allowing the caller to restart the full connection:

wsClient.start({
  eventDispatcher,
  onError: (err) => {
    cleanup();
    reject(err); // triggers reconnection at a higher level
  }
});

Impact

Users with multiple Feishu bot accounts (6 in my case) experience this every 30-40 minutes, requiring constant manual Gateway restarts.

extent analysis

TL;DR

Implement an onError callback in wsClient.start() to handle reconnect attempts and allow the connection to recover.

Guidance

  • Verify that the onError callback is properly rejecting the Promise to trigger reconnection at a higher level.
  • Check the cleanup() function to ensure it properly releases any resources held by the WebSocket connection.
  • Consider adding logging to the onError callback to monitor and debug any future connection issues.
  • Review the reconnect logic at the higher level to ensure it can handle repeated reconnect attempts.

Example

The provided fix suggestion code snippet demonstrates how to implement the onError callback:

wsClient.start({
  eventDispatcher,
  onError: (err) => {
    cleanup();
    reject(err); // triggers reconnection at a higher level
  }
});

Notes

This fix assumes that the reject function is properly defined and will trigger the desired reconnection behavior. Additionally, the cleanup function should be reviewed to ensure it is properly releasing any resources.

Recommendation

Apply the workaround by implementing the onError callback in wsClient.start() to handle reconnect attempts and allow the connection to recover. This should mitigate the issue of Feishu WebSocket disconnects every 30-40 minutes.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Feishu WebSocket reconnect exhausted causes permanent connection freeze [1 participants]