openclaw - 💡(How to fix) Fix 🐛 Feishu Channel: Messages received but not processed (runEmbeddedAgent undefined on first dispatch)

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…

Error Message

Feishu messages are being received by the WebSocket connection (confirmed in OpenClaw logs), but the bot does not respond. No error is shown in the UI, but the gateway fails to process the message. Error that appears in gateway logs when Feishu message arrives: 4. No response is sent, and no visible error in Feishu client

Root Cause

Root Cause Analysis (Code Level)

Fix Action

Fix / Workaround

🐛 Feishu Channel: Messages received but not processed (runEmbeddedAgent undefined on first dispatch)

Why it fails on Feishu:

  1. Timing: Feishu WebSocket's first message triggers dispatchGatewayMethodInProcessrunEmbeddedAgent. This causes loadEmbeddedAgentRuntime() to dynamically import embedded-agent-CGBHhKYO.js for the first time.

  2. Race condition: If loadEmbeddedAgentRuntime() is a Promise that hasn't resolved before the first message dispatch, select(await load()) returns undefined, causing the outer wrapper to throw Cannot read properties of undefined.

Code Example

Cannot read properties of undefined (reading 'runEmbeddedAgent')

---

defineCachedValue(agentRuntime, "runEmbeddedAgent",
 () => createLazyRuntimeMethod(loadEmbeddedAgentRuntime,
 (runtime) => runtime.runEmbeddedAgent)
);

---

const invoke = async (...args) => {
  return await select(await load())(...args);
};

---

// In server-plugin-bootstrap.ts, before Feishu startAccount:
const runtime = createPluginRuntime();
// Trigger the lazy load before first Feishu message arrives
const _ = runtime.agent.runEmbeddedAgent;
RAW_BUFFERClick to expand / collapse

🐛 Feishu Channel: Messages received but not processed (runEmbeddedAgent undefined on first dispatch)

Environment

  • OpenClaw version: 2026.5.28-beta.4
  • Feishu connection mode: WebSocket (persistent connection)
  • Feishu App ID: cli_a94a1c63a7b8dcc7
  • Channel config: Single named account with defaultAccount: "second"

Issue Description

Feishu messages are being received by the WebSocket connection (confirmed in OpenClaw logs), but the bot does not respond. No error is shown in the UI, but the gateway fails to process the message.

Error that appears in gateway logs when Feishu message arrives:

Cannot read properties of undefined (reading 'runEmbeddedAgent')

Root Cause Analysis (Code Level)

After deep source code investigation, the issue is confirmed to be a lazy loading race condition in the OpenClaw runtime:

Location: dist/plugins/runtime/index.js:100

defineCachedValue(agentRuntime, "runEmbeddedAgent",
 () => createLazyRuntimeMethod(loadEmbeddedAgentRuntime,
 (runtime) => runtime.runEmbeddedAgent)
);

How it works: createLazyRuntimeMethod returns an async function:

const invoke = async (...args) => {
  return await select(await load())(...args);
};

Why it fails on Feishu:

  1. Timing: Feishu WebSocket's first message triggers dispatchGatewayMethodInProcessrunEmbeddedAgent. This causes loadEmbeddedAgentRuntime() to dynamically import embedded-agent-CGBHhKYO.js for the first time.

  2. Context isolation: The Feishu WebSocket event callback runs in an isolated microtask queue. When the lazy evaluation executes, the this context or module exports may not be fully resolved yet.

  3. Race condition: If loadEmbeddedAgentRuntime() is a Promise that hasn't resolved before the first message dispatch, select(await load()) returns undefined, causing the outer wrapper to throw Cannot read properties of undefined.

Why other channels (Telegram/Discord) work:

  • They may trigger the runtime loading earlier in the gateway lifecycle (e.g., during gateway startup installGatewayPluginRuntimeEnvironment()), or in a different global context where the lazy import completes successfully.
  • The Feishu channel's message dispatch happens before the plugin runtime is fully warmed up in that specific WebSocket context.

Steps to Reproduce

  1. Start OpenClaw gateway with Feishu WebSocket channel configured
  2. Send a message to Feishu (DM or group)
  3. Message appears in OpenClaw logs as "received"
  4. No response is sent, and no visible error in Feishu client
  5. Gateway logs show: Cannot read properties of undefined (reading 'runEmbeddedAgent')

Expected Behavior

Feishu bot should respond to messages just like Telegram and Discord channels do.

Suggested Fix (Hotfix)

In the gateway startup sequence (before startAccount for Feishu channel), add a pre-warm step to force the lazy evaluation to complete in the correct global context:

// In server-plugin-bootstrap.ts, before Feishu startAccount:
const runtime = createPluginRuntime();
// Trigger the lazy load before first Feishu message arrives
const _ = runtime.agent.runEmbeddedAgent;

Alternatively, ensure setGatewaySubagentRuntime(createGatewaySubagentRuntime()) is called and awaited before any channel starts dispatching messages.

Additional Context

  • Telegram and Discord channels work correctly on the same OpenClaw instance
  • Feishu WebSocket connection appears healthy (messages received)
  • Issue persists across restarts
  • OpenClaw version: 2026.5.28-beta.4

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 Channel: Messages received but not processed (runEmbeddedAgent undefined on first dispatch)