Feishu WebSocket Long Connection Failure: code 1000040351, PingInterval Undefined
WebSocket connection for Feishu/Lark channel fails with 'system busy' errors and 'Cannot read properties of undefined (reading PingInterval)' due to missing wsConfig parameter in WSClient initialization.
🔍 Symptoms
Manifestation Overview
The Feishu/Lark WebSocket long connection mode fails to establish, preventing the OpenClaw Gateway from receiving real-time messages through the Feishu channel. Users encounter a loop of connection failures with cryptic error codes.
Primary Error Patterns
Error Code 1000040351 - System Busy:
[error]: [ '[ws]', 'code: 1000040351, system busy' ]
This error indicates the Lark server is rejecting the WebSocket handshake due to malformed connection parameters.
Property Access Error - PingInterval Undefined:
[error]: [ '[ws]', "Cannot read properties of undefined (reading 'PingInterval')" ]
This critical error confirms the wsConfig object is not being passed to the WebSocket client constructor, causing the SDK to attempt accessing undefined.PingInterval.
Connection Retry Loop:
[error]: [ '[ws]', 'connect failed' ]
[info]: [ 'ws', 'unable to connect to the server after trying N times' ]
The Gateway enters a continuous retry cycle with 25-30 second intervals, never successfully establishing the connection.
Lark Console Verification
In the Lark Developer Console (Events and Callbacks section):
- Attempting to save the “Use long connection to receive events” radio option
- Result: “No application connection detected” validation error
- Event subscription for
im.message.receive_v1cannot be activated
Affected Configuration
The issue manifests exclusively when:
connectionModeis set to"websocket"(not"webhook")- The OpenClaw Feishu channel plugin is loaded
- Gateway startup is attempted
🧠 Root Cause
Technical Analysis
The root cause is a regression introduced in the WSClient initialization logic within the Feishu extension’s client module. The createFeishuWSClient() function fails to pass the mandatory wsConfig parameter required by the @larksuiteoapi/node-sdk v1.59.0+.
Failure Sequence
Step 1: Client Instantiation
The problematic code path in extensions/feishu/src/client.ts: