openclaw - 💡(How to fix) Fix [BUG] Feishu dispatch failure: TypeError Cannot read properties of undefined (reading 'run')

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

TypeError: Cannot read properties of undefined (reading 'run')

Fix Action

Fix / Workaround

2026-06-01T04:06:07.127+08:00 info channels/feishu feishu[main]: received message from ou_e832a734bc33e486a8fc4b68ba5d356b in oc_690456010f282fcd0a4435a844e3c54c (p2p)
2026-06-01T04:06:07.148+08:00 info channels/feishu feishu[main]: dispatching to agent (session=agent:main:main)
2026-06-01T04:06:07.150+08:00 error channels/feishu feishu[main]: failed to dispatch message: TypeError: Cannot read properties of undefined (reading 'run')

2026-06-01T04:12:09.609+08:00 info channels/feishu feishu[default]: Feishu[default] DM from ou_e832a734bc33e486a8fc4b68ba5d356b: /new
2026-06-01T04:12:09.630+08:00 info channels/feishu feishu[default]: dispatching to agent (session=agent:main:main)
2026-06-01T04:12:09.631+08:00 error channels/feishu feishu[default]: failed to dispatch message: TypeError: Cannot read properties of undefined (reading 'run')
收到飞书消息
  └─> buildFeishuInboundLastRouteUpdate()
  └─> createFeishuReplyDispatcher({ agentId, ... })
        └─> const core = getFeishuRuntime()    // ← 这里的 core 可能为 undefined
        └─> core.channel.reply.withReplyDispatcher({
              run: () => core.channel.reply.dispatchReplyFromConfig({...})
            })
  └─> core.channel.inbound.run({ adapter: { resolveTurn, runDispatch } })
        └─> runDispatch() → withReplyDispatcher.run()    // ← 报错

Code Example

TypeError: Cannot read properties of undefined (reading 'run')

---

2026-06-01T04:06:07.127+08:00 info channels/feishu feishu[main]: received message from ou_e832a734bc33e486a8fc4b68ba5d356b in oc_690456010f282fcd0a4435a844e3c54c (p2p)
2026-06-01T04:06:07.148+08:00 info channels/feishu feishu[main]: dispatching to agent (session=agent:main:main)
2026-06-01T04:06:07.150+08:00 error channels/feishu feishu[main]: failed to dispatch message: TypeError: Cannot read properties of undefined (reading 'run')

2026-06-01T04:12:09.609+08:00 info channels/feishu feishu[default]: Feishu[default] DM from ou_e832a734bc33e486a8fc4b68ba5d356b: /new
2026-06-01T04:12:09.630+08:00 info channels/feishu feishu[default]: dispatching to agent (session=agent:main:main)
2026-06-01T04:12:09.631+08:00 error channels/feishu feishu[default]: failed to dispatch message: TypeError: Cannot read properties of undefined (reading 'run')

---

feishu[main]: bot open_id resolved: ou_b956845fd60305ce469bd9e8504dd644

---

收到飞书消息
  └─> buildFeishuInboundLastRouteUpdate()
  └─> createFeishuReplyDispatcher({ agentId, ... })
        └─> const core = getFeishuRuntime()    // ← 这里的 core 可能为 undefined
        └─> core.channel.reply.withReplyDispatcher({
              run: () => core.channel.reply.dispatchReplyFromConfig({...})
            })
  └─> core.channel.inbound.run({ adapter: { resolveTurn, runDispatch } })
        └─> runDispatch() → withReplyDispatcher.run()    // ← 报错

---

function createFeishuReplyDispatcher(params) {
    const core = getFeishuRuntime();   // ← 这里的 core 可能是 undefined
    // ...
}

---

async function withReplyDispatcher(params) {
    try {
        return await params.run();   // ← params.run 不存在时报错
    } finally {
        await settleReplyDispatcher(params);
    }
}
RAW_BUFFERClick to expand / collapse

环境

  • OpenClaw 版本: 2026.5.28 (e932160)
  • Node: v24.15.0
  • OS: Linux (OpenClaw-Srv, Rocky Linux)
  • 安装方式: pnpm (global install)
  • 更新通道: stable
  • 飞书插件: WebSocket 长连接模式,多账号配置

问题描述

飞书消息无法分发,错误信息:

TypeError: Cannot read properties of undefined (reading 'run')

发生时间

  • 首次发现:2026-06-01 04:06:07 (重启后)
  • 再次发现:2026-06-01 04:12:09 (同一会话内)

错误日志(完整)

2026-06-01T04:06:07.127+08:00 info channels/feishu feishu[main]: received message from ou_e832a734bc33e486a8fc4b68ba5d356b in oc_690456010f282fcd0a4435a844e3c54c (p2p)
2026-06-01T04:06:07.148+08:00 info channels/feishu feishu[main]: dispatching to agent (session=agent:main:main)
2026-06-01T04:06:07.150+08:00 error channels/feishu feishu[main]: failed to dispatch message: TypeError: Cannot read properties of undefined (reading 'run')

2026-06-01T04:12:09.609+08:00 info channels/feishu feishu[default]: Feishu[default] DM from ou_e832a734bc33e486a8fc4b68ba5d356b: /new
2026-06-01T04:12:09.630+08:00 info channels/feishu feishu[default]: dispatching to agent (session=agent:main:main)
2026-06-01T04:12:09.631+08:00 error channels/feishu feishu[default]: failed to dispatch message: TypeError: Cannot read properties of undefined (reading 'run')

关键观察

  1. 消息路由到 feishu[default] 而非 feishu[main]

    • 第一次失败:路由到 feishu[main]
    • 第二次失败:路由到 feishu[default](fallback 账号)
  2. 系统当时处于高负载状态

    • Task pressure: 0 queued · 0 running · 211 issues
    • 667 个后台任务,大量 timed_out/failed 的 subagent 会话
  3. 重启后暂时恢复正常(但高负载时再次出现)

  4. 机器人 open_id 已成功解析

    feishu[main]: bot open_id resolved: ou_b956845fd60305ce469bd9e8504dd644

代码追踪

调用链分析

收到飞书消息
  └─> buildFeishuInboundLastRouteUpdate()
  └─> createFeishuReplyDispatcher({ agentId, ... })
        └─> const core = getFeishuRuntime()    // ← 这里的 core 可能为 undefined
        └─> core.channel.reply.withReplyDispatcher({
              run: () => core.channel.reply.dispatchReplyFromConfig({...})
            })
  └─> core.channel.inbound.run({ adapter: { resolveTurn, runDispatch } })
        └─> runDispatch() → withReplyDispatcher.run()    // ← 报错

关键代码位置

createFeishuReplyDispatcher (monitor.account-CJaXe8-T.js:1440)

function createFeishuReplyDispatcher(params) {
    const core = getFeishuRuntime();   // ← 这里的 core 可能是 undefined
    // ...
}

withReplyDispatcher (dispatch-DphqeP-y.js:74)

async function withReplyDispatcher(params) {
    try {
        return await params.run();   // ← params.run 不存在时报错
    } finally {
        await settleReplyDispatcher(params);
    }
}

可能的根本原因

getFeishuRuntime() 返回 undefined,说明飞书插件运行时未初始化:

  1. WebSocket 连接未建立时:飞书账号的 WebSocket 连接失败或未就绪
  2. 高并发场景下竞态条件:系统负载高时,飞书运行时初始化被延迟
  3. default 账号没有独立的运行时:fallback 到 default 时,core 依然为 undefined

建议

  1. createFeishuReplyDispatcher 中增加 core 的空值检查
  2. withReplyDispatcher 中对 params.run 进行存在性检查
  3. default 账号配置独立的运行时
  4. 在飞书 WebSocket 连接断开时,缓存/拒绝新消息而不是 fallback 到 default

相关提交(v2026.5.28 → v2026.5.31-beta.3)

  • 1af4c035: refactor: move delivery queues to SQLite (#88665)
  • fa2b2ffa: fix(channels): recover failed progress draft starts (#88749)
  • e8c7c933: Retry stale CLI sessions in runner lifecycle
  • 1e54e908: fix: queue subagent completion handoffs (#88613)

报告时间:2026-06-01 报告人:刘华 (liuhua1202)

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 [BUG] Feishu dispatch failure: TypeError Cannot read properties of undefined (reading 'run')