Skip to content

[Bug] Matrix channel dispatch broken in v2026.5.27/5.28 — TypeError: Cannot read properties of undefined (reading 'run') #88694

Closed

Description

@KundKMC

Bug type

Regression (worked before, now fails)

Beta release blocker

No (affects stable v2026.5.27 and v2026.5.28)

Summary

After updating from 2026.5.12 to 2026.5.27 (and confirmed in 2026.5.28), the Matrix channel handler crashes on every inbound message with:

[matrix] handler failed: TypeError: Cannot read properties of undefined (reading 'run')

The bot logs in successfully (matrix: logged in as @<bot>:matrix.<host>), syncs rooms, receives RTC session events, but fails to dispatch any inbound message turn. Users see the bot read their messages without ever responding.

This matches the same crash pattern reported for other channels in this version line:

→ Looks like a structural plugin-runtime regression affecting multiple channel inbound dispatchers.

Environment

  • OpenClaw Core: verified on 2026.5.27 and 2026.5.28
  • Plugin @openclaw/matrix: verified on 2026.3.13, 2026.5.27, and 2026.5.28 (all three crash the same way)
  • Runtime: Node 22.22.2, npm 10.9.7
  • OS: Linux (systemd service), Debian 12
  • Channel: Matrix (self-hosted homeserver)
  • Plugins active (8): active-memory, llm-task, lobster, matrix, memory-core, memory-wiki, nextcloud-talk, openai

Steps to reproduce

  1. Existing bot on stable 2026.5.12 with @openclaw/matrix@2026.3.13 running cleanly (14 days uptime, no errors)
  2. NPM_CONFIG_PREFIX=~/.npm-global npm install -g openclaw@2026.5.27
  3. systemctl restart openclaw
  4. ensure-matrix-sdk auto-installs @vector-im/matrix-bot-sdk (related: [Bug]: @vector-im/matrix-bot-sdk missing from dependencies in all 2026.5.x releases (Matrix bridge crash-loops on install) #87990)
  5. Bot logs in successfully to Matrix
  6. Every inbound message triggers matrix handler failed: TypeError: Cannot read properties of undefined (reading 'run')

Also tried (none fix the crash):

  • Upgrade plugin to @openclaw/matrix@2026.5.27 (matched core version) — same crash
  • Upgrade plugin to @openclaw/matrix@2026.5.28 (peer-dep openclaw: '>=2026.5.28') and core to 2026.5.28 — same crash
  • Restart between every step — same crash

Only 2026.5.12 + @openclaw/matrix@2026.3.13 is functional.

Failing code location

The bundled chunk path varies per build but the call site is consistent. In 2026.5.28 core:

dist/monitor.account-CJaXe8-T.js:2870:	const turnResult = await core.channel.inbound.run({
dist/monitor-DWJ7KlrE.js:138:	await core.channel.inbound.run({
dist/channel-runtime-Eq3ifkF3.js:280:	await core.channel.inbound.dispatchReply({

The @openclaw/matrix@2026.5.28 plugin chunk also calls:

dist/monitor-COOR-Ksj.js:	const turnResult = await core.channel.inbound.run({...})

→ core.channel.inbound is undefined at runtime, suggesting the plugin-runtime core object is not having channel.inbound populated before the inbound handler runs. The plugin-SDK file dist/plugin-sdk/channel-inbound.js exists in the core bundle, so the symbol is exported but apparently not wired into the plugin-facing core namespace.

Observed error (log excerpt)

2026-05-31T17:42:51 [gateway] loading configuration…
2026-05-31T17:43:03 [gateway] http server listening (8 plugins: ..., matrix, ...)
2026-05-31T17:43:04 [matrix] [default] starting provider (https://matrix.<host>)
2026-05-31T17:43:04 [ensure-matrix-sdk] @vector-im/matrix-bot-sdk missing! Installing...
2026-05-31T17:43:55 [ensure-matrix-sdk] @vector-im/matrix-bot-sdk installed successfully.
2026-05-31T17:44:30 matrix: logged in as @<bot>:matrix.<host>
2026-05-31T17:44:30 [MatrixClient] Resuming queue after resumed sync
2026-05-31T17:44:38 [matrix] handler failed: TypeError: Cannot read properties of undefined (reading 'run')
2026-05-31T17:44:58 [matrix] handler failed: TypeError: Cannot read properties of undefined (reading 'run')
... (every inbound message)

Stack trace is not surfaced in the log (the message is the only line captured), but the location can be derived from grep over the matrix-plugin bundle (monitor-*.js → core.channel.inbound.run).

Expected

core.channel.inbound.run(...) is callable at message dispatch time, the inbound turn completes, the bot replies normally as it did on 2026.5.12.

Workaround

Full rollback to 2026.5.12 core + @openclaw/matrix@2026.3.13 plugin + restore the pre-update openclaw.json config snapshot. Verified working immediately after rollback (0 errors, clean Matrix login, normal reply dispatch).

NPM_CONFIG_PREFIX=~/.npm-global npm install -g openclaw@2026.5.12 @openclaw/matrix@2026.3.13
cp ~/.openclaw/openclaw.json.bak-pre-5.27 ~/.openclaw/openclaw.json
systemctl restart openclaw

Note: @openclaw/matrix@2026.3.13 is now npm-deprecated (Deprecated: obsolete OpenClaw plugin package version) but functionally fine on 2026.5.12.

Related

Activity

  1. clawsweeper commented on May 31, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed May 31, 2026, 12:11 PM ET / 16:11 UTC.

    Summary
    Keep open. The report is a fresh, detailed stable-release Matrix dispatch regression, and related open reports show the same missing runtime method symptom on other channels; current main/source inspection does not provide enough proof that the user-visible problem is already fixed.

    Reproducibility: no. The issue gives detailed release logs and exact call sites, but current main and inspected v2026.5.28 artifacts both expose channel.inbound, so I did not establish a failing current-main Matrix run.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.

    Next step
    A maintainer or live-validation pass should first pin the packaged runtime failure, because source and artifact inspection do not yet explain why channel.inbound is undefined in the reported install.

    Review details

    Best possible solution:

    Reproduce the packaged Matrix path, identify whether runtime injection or core/plugin version resolution is dropping channel.inbound, then fix the shared runtime boundary and validate Matrix plus the sibling affected channels before release.

    Do we have a high-confidence way to reproduce the issue?

    No. The issue gives detailed release logs and exact call sites, but current main and inspected v2026.5.28 artifacts both expose channel.inbound, so I did not establish a failing current-main Matrix run.

    Is this the best way to solve the issue?

    Unclear. The Matrix code is already using the documented runtime.channel.inbound.run(...) API, so the likely fix should target packaged runtime injection or version skew rather than a blind API rename.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The current source and inspected v2026.5.28 artifacts expose channel.inbound, so the exact runtime failure still needs a packaged/global-install or live Matrix reproduction before a narrow fix is safe.
    • Because related Feishu and BlueBubbles reports remain open with the same symptom, a one-channel patch could miss a shared plugin runtime injection or release-skew bug.

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 63621eead219.

    Label changes

    Label changes:

    • add P1: The report describes a current stable-release regression where Matrix inbound messages are received but never dispatch to the agent.
    • add impact:message-loss: The affected workflow drops all Matrix replies after inbound receipt, which is a channel message-delivery failure.
    • add issue-rating: 🦪 silver shellfish: Current issue advisory state selects this label.
    • add clawsweeper:needs-info: Current issue advisory state selects this label.
    • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
    • add clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.

    Label justifications:

    • P1: The report describes a current stable-release regression where Matrix inbound messages are received but never dispatch to the agent.
    • impact:message-loss: The affected workflow drops all Matrix replies after inbound receipt, which is a channel message-delivery failure.
    Evidence reviewed

    What I checked:

    • Reported release behavior: The issue reports that OpenClaw v2026.5.27 and v2026.5.28 receive Matrix events but fail every inbound dispatch with TypeError: Cannot read properties of undefined (reading 'run'), leaving users without replies.
    • Matrix current-main call site: Matrix inbound dispatch currently calls core.channel.inbound.run(...) from the monitor handler, matching the reported failing symbol path. (extensions/matrix/src/matrix/monitor/handler.ts:2148, 63621eead219)
    • Runtime source exposes inbound helpers: Current main builds channel.inbound with buildContext, run, runPreparedReply, and dispatchReply, so the remaining failure is likely in runtime injection, package resolution, or release/plugin skew rather than a missing source helper. (src/plugins/runtime/runtime-channel.ts:182, 63621eead219)
    • Plugin loader runtime injection path: The loader applies the plugin runtime with setChannelRuntime(api.runtime) for runtime/setup channel entries; this is the likely boundary to verify against the packaged Matrix install path. (src/plugins/loader.ts:2425, 63621eead219)
    • Documented SDK contract: The channel inbound docs say the old runtime.channel.turn.* aliases were removed and plugins should use runtime.channel.inbound.run(...), so the Matrix call is aligned with the intended current contract. Public docs: docs/plugins/sdk-channel-inbound.md. (docs/plugins/sdk-channel-inbound.md:60, 63621eead219)
    • Published artifact inspection: Packed openclaw@2026.5.28 and @openclaw/matrix@2026.5.28 artifacts show Matrix still calls core.channel.inbound.run(...), while the core artifact includes a runtime-channel chunk with inbound.run; this does not prove the reported packaged runtime object is healthy.

    Likely related people:

    • Peter Steinberger: Blame and history tie the current runtime channel builder, loader/runtime injection path, and Matrix inbound call site to recent plugin runtime/channel work. (role: recent area contributor; confidence: medium; commits: 2b61d38a455c, f59d0eac687f, 63cbc097b5ca; files: src/plugins/runtime/runtime-channel.ts, src/plugins/loader.ts, src/plugin-sdk/channel-entry-contract.ts)
    • Gustavo Madeira Santana: Recent Matrix history includes multiple monitor, streaming, routing, approval, and E2EE verification changes adjacent to the inbound dispatch path. (role: Matrix area contributor; confidence: medium; commits: 0f7c40e50885, d78512b09d1d, 8a841b531fd2; files: extensions/matrix/src/matrix/monitor/handler.ts, extensions/matrix/src/matrix/draft-stream.ts, extensions/matrix/src/approval-native.ts)
    • Vincent Koc: History shows adjacent Matrix and Feishu plugin runtime work, including Matrix delivery replay and plugin runtime store type splits around channel dispatch surfaces. (role: adjacent plugin/channel contributor; confidence: medium; commits: 6c4cfa585fb9, 9d717176d32c, f45e5a6569aa; files: extensions/matrix/src/matrix/monitor/handler.ts, extensions/feishu/src/bot.ts, src/plugins/runtime/types-channel.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on May 31, 2026
  3. steipete commented on May 31, 2026

    @steipete
    Contributor

    Fixed on current main by d05e4a4bc6 (fix(feishu): use full gateway channel runtime).

    Proof on current main:

    • Gateway channel startup now resolves the full plugin channel runtime via resolveChannelRuntime: getChannelRuntime and passes it through createTaskScopedChannelRuntime(...) before startAccount(...) runs.
    • createRuntimeChannel() exposes channel.inbound.run, so channel plugins no longer receive a partial channel surface missing inbound.
    • src/gateway/server-channels.test.ts now asserts bundled startup receives a full runtime and typeof ctx.channelRuntime.inbound.run === "function"; non-bundled channels keep the same full runtime path.
    • Local verification passed: node scripts/run-vitest.mjs src/gateway/server-channels.test.ts.

    Closing as fixed on main. If this still reproduces on a build after d05e4a4bc6, please reopen with the exact OpenClaw build SHA/version and fresh channel startup logs from that build.

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

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions