openclaw - ✅(Solved) Fix Bundled `feishu` plugin: missing `@larksuiteoapi/node-sdk` runtime dep + `plugins disable` self-blocks [1 pull requests, 1 comments, 2 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#78321Fetched 2026-05-07 03:38:16
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
commented ×1cross-referenced ×1

A vanilla install of openclaw leaves the bundled feishu plugin with an unresolvable require('@larksuiteoapi/node-sdk'). Two upstream code paths still load the extension before honoring the enabled flag — the gateway request handler and the config-reload pipeline — so the error fires recurrently even when the user has never configured Feishu. Both openclaw plugins disable feishu and openclaw plugins uninstall feishu fail to fix it: disable itself crashes with the same MODULE_NOT_FOUND (its plugin-resolution path eagerly loads the api chain before writing the disable flag), and uninstall refuses because feishu is origin: bundled. The only working remediation is hand-editing openclaw.json to add plugins.entries.feishu = { enabled: false }.

Error Message

  • Recurring MODULE_NOT_FOUND in two production paths: the config-reload watcher (every openclaw.json rewrite/hot-reload) and the gateway request handler (any external capability probe). 7 occurrences in the local gateway.err.log over a 13-day window (the path only fires when triggered, not continuously, but every trigger fails).
  • The plugins disable CLI crashes with the same error it is meant to silence. The CLI is structurally unable to fix this bug.
  • The plugins uninstall CLI rejects bundled plugins by design.
  • Workaround that works: hand-edit ~/.openclaw/openclaw.json and add plugins.entries.feishu = { enabled: false }. The config-reload watcher checks plugins.entries.<id>.enabled BEFORE requiring the extension api, so this disables cleanly. Verified via openclaw daemon restart + 30s tail of gateway.err.log: zero subsequent larksuiteoapi/feishu/MODULE_NOT_FOUND occurrences. openclaw plugins inspect feishu status changed from Error: bundled (disabled by default) to Error: disabled in config.

Root Cause

A vanilla install of openclaw leaves the bundled feishu plugin with an unresolvable require('@larksuiteoapi/node-sdk'). Two upstream code paths still load the extension before honoring the enabled flag — the gateway request handler and the config-reload pipeline — so the error fires recurrently even when the user has never configured Feishu. Both openclaw plugins disable feishu and openclaw plugins uninstall feishu fail to fix it: disable itself crashes with the same MODULE_NOT_FOUND (its plugin-resolution path eagerly loads the api chain before writing the disable flag), and uninstall refuses because feishu is origin: bundled. The only working remediation is hand-editing openclaw.json to add plugins.entries.feishu = { enabled: false }.

Fix Action

Fix / Workaround

  • Recurring MODULE_NOT_FOUND in two production paths: the config-reload watcher (every openclaw.json rewrite/hot-reload) and the gateway request handler (any external capability probe). 7 occurrences in the local gateway.err.log over a 13-day window (the path only fires when triggered, not continuously, but every trigger fails).
  • The plugins disable CLI crashes with the same error it is meant to silence. The CLI is structurally unable to fix this bug.
  • The plugins uninstall CLI rejects bundled plugins by design.
  • Workaround that works: hand-edit ~/.openclaw/openclaw.json and add plugins.entries.feishu = { enabled: false }. The config-reload watcher checks plugins.entries.<id>.enabled BEFORE requiring the extension api, so this disables cleanly. Verified via openclaw daemon restart + 30s tail of gateway.err.log: zero subsequent larksuiteoapi/feishu/MODULE_NOT_FOUND occurrences. openclaw plugins inspect feishu status changed from Error: bundled (disabled by default) to Error: disabled in config.

openclaw plugins inspect feishu before workaround:

PR fix notes

PR #78375: fix: skip module loading for disabled plugins in loadOpenClawPlugins

Description (problem / solution / changelog)

When a plugin's enableState.enabled is false, the loader previously set the record status to "disabled" but continued to execute the module loading code path below. This caused bundled plugins with missing runtime dependencies (e.g. feishu's @larksuiteoapi/node-sdk) to crash with MODULE_NOT_FOUND during config-reload and gateway request handling.

Now the disabled branch properly pushes the record, marks the seen ID, and continues to the next plugin — matching the pattern used by other early-exit conditions in the same loop.

Closes #78321

Summary

  • Problem: Disabled bundled plugins (e.g. feishu) still had their modules loaded via getJiti(), crashing with MODULE_NOT_FOUND when runtime deps like @larksuiteoapi/node-sdk are missing
  • Why it matters: Recurring crashes in config-reload and gateway request paths on vanilla installs; openclaw plugins disable CLI also crashes with the same error it's meant to silence
  • What changed: Added registry.plugins.push(record), seenIds.set(pluginId, candidate.origin), and continue to the !enableState.enabled branch in loadOpenClawPlugins, so disabled plugins skip module loading entirely
  • What did NOT change (scope boundary): No changes to the enable-state resolution logic, bundled plugin packaging, or the plugins disable CLI command itself — the CLI fix is a side effect of the loader now correctly short-circuiting

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #78321
  • Related #
  • This PR fixes a bug or regression

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: MODULE_NOT_FOUND crash for @larksuiteoapi/node-sdk during config-reload and gateway request handling
  • Real environment tested: macOS 26.2, node v25.6.1, openclaw installed from source (commit b3d9948c4c)
  • Exact steps or command run after this patch: openclaw daemon restart && sleep 5 && tail gateway.err.log — zero MODULE_NOT_FOUND occurrences; openclaw plugins inspect feishu shows Status: disabled in config
  • Evidence after fix: No [reload] config restart failed or [gateway] request handler failed entries referencing @larksuiteoapi/node-sdk after 30s observation
  • Observed result after fix: feishu plugin record exists in registry with status: "disabled", no module evaluation attempted
  • What was not tested: feishu plugin with SDK actually installed and enabled (don't have Feishu credentials)
  • Before evidence: See issue #78321 production log evidence (7 occurrences over 13 days)

Root Cause (if applicable)

  • Root cause: The !enableState.enabled branch at line 2493 in loader.ts set status and called markPluginActivationDisabled() but did not continue — execution fell through to the module loading block at line 2725 which calls getJiti(safeSource)(safeImportSource), triggering the full import chain
  • Missing detection / guardrail: No test asserts that disabled plugins skip module evaluation; the loop has 6 other early-exit patterns that all use continue, this one was the exception
  • Contributing context: The shouldInstallBundledRuntimeDeps guard at line 2499 checks enableState.enabled but only gates dependency installation, not the later unconditional module load

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/plugins/loader.test.ts
  • Scenario the test should lock in: A bundled plugin with enabledByDefault: false and a missing runtime dep should produce a status: "disabled" record without triggering module evaluation
  • Why this is the smallest reliable guardrail: Unit-level mock of getJiti can assert it was never called for disabled plugins
  • Existing test that already covers this (if any): None found
  • If no new test is added, why not: Maintainers have better context on the test harness setup for plugin loading; happy to add one if guided

User-visible / Behavior Changes

  • Disabled bundled plugins no longer produce MODULE_NOT_FOUND errors in logs
  • openclaw plugins disable <id> no longer crashes when the target plugin has missing deps
  • openclaw plugins inspect <id> for disabled bundled plugins shows disabled in config instead of Error: Cannot find module

Diagram (if applicable)

Before:
[config-reload] -> loadOpenClawPlugins -> enableState.enabled=false -> set status
"disabled" -> CONTINUE TO MODULE LOAD -> getJiti() -> MODULE_NOT_FOUND crash

After:
[config-reload] -> loadOpenClawPlugins -> enableState.enabled=false -> set status
"disabled" -> push record + continue -> SKIP MODULE LOAD -> no crash

Security Impact (required)

- New permissions/capabilities? No
- Secrets/tokens handling changed? No
- New/changed network calls? No
- Command/tool execution surface changed? No
- Data access scope changed? No

Repro + Verification

Environment

- OS: macOS 26.2 (Darwin 25.2.0)
- Runtime/container: node v25.6.1
- Model/provider: N/A
- Integration/channel: feishu (bundled, never configured)
- Relevant config: default openclaw.json, no plugins.entries.feishu key

Steps

1. Fresh install of openclaw (brew or npm)
2. Trigger config reload (openclaw doctor or edit openclaw.json)
3. Observe gateway.err.log

Expected

- No MODULE_NOT_FOUND errors for disabled plugins

Actual (before fix)

- [reload] config restart failed: Error: Cannot find module
'@larksuiteoapi/node-sdk'

Evidence

- Failing test/log before + passing after
- Trace/log snippets
- Screenshot/recording
- Perf numbers (if relevant)

Human Verification (required)

- Verified scenarios: config-reload path no longer crashes for disabled feishu
plugin; plugin record correctly shows disabled status in registry
- Edge cases checked: other early-exit branches in the same loop still work
(duplicate-id, validation failure); enabled plugins still load normally
- What you did not verify: feishu plugin with SDK installed and Feishu credentials
configured

Review Conversations

- I replied to or resolved every bot review conversation I addressed in this PR.
- I left unresolved only the conversations that still need reviewer or maintainer
judgment.

Compatibility / Migration

- Backward compatible? Yes
- Config/env changes? No
- Migration needed? No

Risks and Mitigations

- Risk: A plugin that was previously disabled but still had its module loaded (for
side-effect registration) would now skip that load
  - Mitigation: Disabled plugins should never execute — this matches the documented
behavior and the pattern of every other early-exit in the loop. The
shouldInstallBundledRuntimeDeps block already gates on enableState.enabled,
confirming intent.

## Changed files

- `src/plugins/loader.ts` (modified, +3/-0)

Code Example

[reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
   - /opt/homebrew/lib/node_modules/openclaw/dist/extensions/feishu/client-yWGpoGkZ.js

---

[gateway] request handler failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
   - /opt/homebrew/lib/node_modules/openclaw/dist/extensions/feishu/client-yWGpoGkZ.js: code=MODULE_NOT_FOUND

---

{
  "name": "@openclaw/feishu",
  "version": "2026.4.20",
  "dependencies": {
    "@larksuiteoapi/node-sdk": "^1.60.0",
    "@sinclair/typebox": "0.34.49",
    "qrcode-terminal": "^0.12.0"
  },
  "openclaw": {
    "bundle": { "stageRuntimeDependencies": true },
    ...
  }
}

---

"files": [
  "CHANGELOG.md",
  "LICENSE",
  "openclaw.mjs",
  "README.md",
  "assets/",
  "dist/",
  "!dist/**/*.map",
  "!dist/plugin-sdk/.tsbuildinfo",
  "!dist/extensions/node_modules/**",
  "!dist/extensions/*/node_modules/**",
  ...
]

---

import { n as listEnabledFeishuAccounts } from "./accounts-C32zclXX.js";

---

import { ... } from "./drive-CqL2E2AR.js";

---

import { r as createFeishuClient } from "./client-yWGpoGkZ.js";

---

import * as Lark from "@larksuiteoapi/node-sdk";

---

2026-04-25T12:20:55-04:00 [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-04-27T04:00:39-04:00 [gateway] request handler failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-05-03T19:28:29-04:00 [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-05-04T04:00:40-04:00 [gateway] request handler failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-05-04T13:42:37-04:00 [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-05-05T12:59:28-04:00 [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-05-05T17:06:51-04:00 [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'

---

Status: Error: bundled (disabled by default)
Error: Cannot find module '@larksuiteoapi/node-sdk'
RAW_BUFFERClick to expand / collapse

Environment

  • openclaw 2026.4.21 (commit f788c88), installed via brew install openclaw (/opt/homebrew/lib/node_modules/openclaw)
  • @openclaw/feishu 2026.4.20 (bundled, dist/extensions/feishu/)
  • node v25.6.1
  • macOS 26.2 (Darwin 25.2.0)

Summary

A vanilla install of openclaw leaves the bundled feishu plugin with an unresolvable require('@larksuiteoapi/node-sdk'). Two upstream code paths still load the extension before honoring the enabled flag — the gateway request handler and the config-reload pipeline — so the error fires recurrently even when the user has never configured Feishu. Both openclaw plugins disable feishu and openclaw plugins uninstall feishu fail to fix it: disable itself crashes with the same MODULE_NOT_FOUND (its plugin-resolution path eagerly loads the api chain before writing the disable flag), and uninstall refuses because feishu is origin: bundled. The only working remediation is hand-editing openclaw.json to add plugins.entries.feishu = { enabled: false }.

Reproduction

  1. Fresh install on a host that has never configured Feishu: brew install openclaw (or npm i -g openclaw).
  2. Trigger any config reload (e.g. edit ~/.openclaw/openclaw.json, run openclaw doctor, or restart the gateway). gateway.err.log:
    [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
    - /opt/homebrew/lib/node_modules/openclaw/dist/extensions/feishu/client-yWGpoGkZ.js
  3. Wait for an external WebSocket client to query channel capabilities (observed daily ~03:00–04:00 ET in production). gateway.err.log:
    [gateway] request handler failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
    - /opt/homebrew/lib/node_modules/openclaw/dist/extensions/feishu/client-yWGpoGkZ.js: code=MODULE_NOT_FOUND
  4. Try the documented fix: openclaw plugins disable feishu. Crashes with the same MODULE_NOT_FOUND — the disable command's plugin-resolution path loads feishu/api.js → drive → client → @larksuiteoapi/node-sdk before writing the disable flag.
  5. Try removing it: openclaw plugins uninstall feishu. Refuses with Plugin 'feishu' is not managed by plugins config/install records and cannot be uninstalled because feishu is origin: bundled (not separately installed).

Observed behavior

  • Recurring MODULE_NOT_FOUND in two production paths: the config-reload watcher (every openclaw.json rewrite/hot-reload) and the gateway request handler (any external capability probe). 7 occurrences in the local gateway.err.log over a 13-day window (the path only fires when triggered, not continuously, but every trigger fails).
  • The plugins disable CLI crashes with the same error it is meant to silence. The CLI is structurally unable to fix this bug.
  • The plugins uninstall CLI rejects bundled plugins by design.
  • Workaround that works: hand-edit ~/.openclaw/openclaw.json and add plugins.entries.feishu = { enabled: false }. The config-reload watcher checks plugins.entries.<id>.enabled BEFORE requiring the extension api, so this disables cleanly. Verified via openclaw daemon restart + 30s tail of gateway.err.log: zero subsequent larksuiteoapi/feishu/MODULE_NOT_FOUND occurrences. openclaw plugins inspect feishu status changed from Error: bundled (disabled by default) to Error: disabled in config.

Expected behavior

A bundled plugin the user has never configured should not be able to crash the config-reload pipeline or the gateway request handler. openclaw plugins disable <id> should never fail with the same error it is meant to silence.

Evidence

dist/extensions/feishu/package.json declares the SDK as a runtime dep:

{
  "name": "@openclaw/feishu",
  "version": "2026.4.20",
  "dependencies": {
    "@larksuiteoapi/node-sdk": "^1.60.0",
    "@sinclair/typebox": "0.34.49",
    "qrcode-terminal": "^0.12.0"
  },
  "openclaw": {
    "bundle": { "stageRuntimeDependencies": true },
    ...
  }
}

The manifest's bundle.stageRuntimeDependencies: true flag suggests intent to ship runtime deps; the publish pipeline does not act on it.

openclaw root package.json files array (lines 23–51) explicitly excludes per-extension node_modules:

"files": [
  "CHANGELOG.md",
  "LICENSE",
  "openclaw.mjs",
  "README.md",
  "assets/",
  "dist/",
  "!dist/**/*.map",
  "!dist/plugin-sdk/.tsbuildinfo",
  "!dist/extensions/node_modules/**",
  "!dist/extensions/*/node_modules/**",
  ...
]

Result: dist/extensions/feishu/node_modules/ does not exist on a vanilla install. The SDK is declared but never published to disk.

Load chain api.js → drive → client → @larksuiteoapi/node-sdk (this is what the disable command resolves before honoring the flag):

dist/extensions/feishu/api.js:1:

import { n as listEnabledFeishuAccounts } from "./accounts-C32zclXX.js";

dist/extensions/feishu/api.js:7:

import { ... } from "./drive-CqL2E2AR.js";

dist/extensions/feishu/drive-CqL2E2AR.js:2:

import { r as createFeishuClient } from "./client-yWGpoGkZ.js";

dist/extensions/feishu/client-yWGpoGkZ.js:3:

import * as Lark from "@larksuiteoapi/node-sdk";

Production log evidence (recurring over 10+ days):

2026-04-25T12:20:55-04:00 [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-04-27T04:00:39-04:00 [gateway] request handler failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-05-03T19:28:29-04:00 [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-05-04T04:00:40-04:00 [gateway] request handler failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-05-04T13:42:37-04:00 [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-05-05T12:59:28-04:00 [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'
2026-05-05T17:06:51-04:00 [reload] config restart failed: Error: Cannot find module '@larksuiteoapi/node-sdk'

Each error referenced dist/extensions/feishu/client-yWGpoGkZ.js as the failing require site.

openclaw plugins inspect feishu before workaround:

Status: Error: bundled (disabled by default)
Error: Cannot find module '@larksuiteoapi/node-sdk'

Suggested fix directions (any one closes the bug)

  • (a) Honor the enabled flag earlier — the highest-leverage path. Make both the gateway request handler and the CLI's plugins disable resolve plugins.entries.<id>.enabled BEFORE doing any require() of the extension's api. The config-reload watcher already does this — generalize the pattern. This also fixes the broken plugins disable CLI.
  • (b) Mark the SDK optional — move @larksuiteoapi/node-sdk to peerDependenciesMeta.optional = true and gate the import behind a runtime feature check (lazy await import() inside an async setup path that's only called when a feishu channel is actually wired in plugins.entries).
  • (c) Ship the dep — drop !dist/extensions/*/node_modules/** from the root files array, OR hoist @larksuiteoapi/node-sdk into the openclaw root dependencies. The bundle.stageRuntimeDependencies: true flag in the feishu manifest already signals intent; honor it in the publish pipeline.

(a) is the most defensive — it makes the host robust to any bundled plugin's missing-dep failure, not just feishu's. (c) is the narrowest fix for this specific plugin.

Notes for upstream

  • The bundle.stageRuntimeDependencies: true flag is present in the feishu manifest but appears to be unused by the current publish step. If it is intended to drive the include logic for dist/extensions/<id>/node_modules/, the negation rule in openclaw/package.json files (!dist/extensions/*/node_modules/**) overrides it.
  • The same class of bug likely affects any bundled extension with a runtime dep that isn't in openclaw's root dependencies. A scan for other import ... from "<external-pkg>" lines in dist/extensions/*/ would surface peers.

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…

FAQ

Expected behavior

A bundled plugin the user has never configured should not be able to crash the config-reload pipeline or the gateway request handler. openclaw plugins disable <id> should never fail with the same error it is meant to silence.

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 - ✅(Solved) Fix Bundled `feishu` plugin: missing `@larksuiteoapi/node-sdk` runtime dep + `plugins disable` self-blocks [1 pull requests, 1 comments, 2 participants]