openclaw - 💡(How to fix) Fix [Bug]: bundled plugin runtime-deps don't link openclaw, so Discord/Telegram/etc. crash on 2026.4.22 with 'Cannot find package openclaw' [1 comments, 1 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#70661Fetched 2026-04-24 05:55:01
View on GitHub
Comments
1
Participants
1
Timeline
6
Reactions
0
Participants
Timeline (top)
subscribed ×2closed ×1commented ×1cross-referenced ×1

After upgrading to 2026.4.22, bundled channel plugins (Discord, probably others that have moved to external openclaw/plugin-sdk/* imports in this release) crash at startup with:

Cannot find package 'openclaw' imported from
/home/<user>/.openclaw/plugin-runtime-deps/openclaw-2026.4.22-<hash>/dist/extensions/discord/token-D-w3Rigl.js

…and enter auto-restart crashloop (1/10, 2/10, … 10/10).

This is distinct from #70436 / #70462 which fix third-party openclaw plugins install <pkg> flows. The failing codepath here is src/plugins/bundled-runtime-deps.ts (bundled extensions shipped inside the openclaw package itself).

Error Message

  1. Gateway boots but Discord enters crashloop; logs show the Cannot find package 'openclaw' error above.

Root Cause

src/plugins/bundled-runtime-deps.tsinstallBundledRuntimeDeps runs npm install <specs> at an external installRoot (under ~/.openclaw/plugin-runtime-deps/openclaw-<version>-<hash>/). The specs come from collectRuntimeDeps(packageJson) which reads the plugin's package.json (dist/extensions/discord/package.json).

The Discord plugin's package.json does not declare openclaw as a dependency (it's implicit — the plugin ships inside openclaw). But the bundled output files (e.g. token-D-w3Rigl.js, accounts-zcI4mtzH.js, agent-components.runtime-Bu_xCRPb.js) now contain bare external imports from the openclaw/plugin-sdk/* subpath exports (likely introduced as part of the shared helpers consolidation in 2026.4.22).

Result: installRoot/node_modules/ contains all declared deps (@discordjs/voice, @buape/carbon, etc.) but no openclaw entry, so Node.js module resolution fails.

The exact same fix pattern proposed in #70462 applies here too, just in a different file: after the bundled install completes, symlink {installRoot}/node_modules/openclaw → the packageRoot computed by resolveBundledPluginPackageRoot(pluginRoot). resolveExternalBundledRuntimeDepsInstallRoot already computes packageRoot at line 324, so it's already in scope.

Fix Action

Fix / Workaround

No — workaround below.

Workaround (confirmed fixes Discord on 2026.4.22)

Code Example

Cannot find package 'openclaw' imported from
/home/<user>/.openclaw/plugin-runtime-deps/openclaw-2026.4.22-<hash>/dist/extensions/discord/token-D-w3Rigl.js

---

[discord] [default] starting provider
[discord] [default] channel exited: Cannot find package 'openclaw' imported from .openclaw/plugin-runtime-deps/openclaw-2026.4.22-<hash>/dist/extensions/discord/token-D-w3Rigl.js
[discord] [default] auto-restart attempt 5/10 in 82s

---

ln -s /usr/lib/openclaw \
  ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.22-<hash>/node_modules/openclaw
openclaw gateway restart
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No — workaround below.

Summary

After upgrading to 2026.4.22, bundled channel plugins (Discord, probably others that have moved to external openclaw/plugin-sdk/* imports in this release) crash at startup with:

Cannot find package 'openclaw' imported from
/home/<user>/.openclaw/plugin-runtime-deps/openclaw-2026.4.22-<hash>/dist/extensions/discord/token-D-w3Rigl.js

…and enter auto-restart crashloop (1/10, 2/10, … 10/10).

This is distinct from #70436 / #70462 which fix third-party openclaw plugins install <pkg> flows. The failing codepath here is src/plugins/bundled-runtime-deps.ts (bundled extensions shipped inside the openclaw package itself).

Steps to reproduce

  1. Install openclaw 2026.4.22 globally / from AUR / from source, with /usr/lib/openclaw (or equivalent package root) not writable by the service user.
  2. Have a Discord channel configured (any other bundled plugin whose bundled .js now does import … from "openclaw/plugin-sdk/…" should reproduce too — Telegram, WhatsApp, Signal have similar patterns in the dist/extensions/*/ output).
  3. Start the gateway.
  4. Gateway boots but Discord enters crashloop; logs show the Cannot find package 'openclaw' error above.
[discord] [default] starting provider
[discord] [default] channel exited: Cannot find package 'openclaw' imported from .openclaw/plugin-runtime-deps/openclaw-2026.4.22-<hash>/dist/extensions/discord/token-D-w3Rigl.js
[discord] [default] auto-restart attempt 5/10 in 82s

Root cause

src/plugins/bundled-runtime-deps.tsinstallBundledRuntimeDeps runs npm install <specs> at an external installRoot (under ~/.openclaw/plugin-runtime-deps/openclaw-<version>-<hash>/). The specs come from collectRuntimeDeps(packageJson) which reads the plugin's package.json (dist/extensions/discord/package.json).

The Discord plugin's package.json does not declare openclaw as a dependency (it's implicit — the plugin ships inside openclaw). But the bundled output files (e.g. token-D-w3Rigl.js, accounts-zcI4mtzH.js, agent-components.runtime-Bu_xCRPb.js) now contain bare external imports from the openclaw/plugin-sdk/* subpath exports (likely introduced as part of the shared helpers consolidation in 2026.4.22).

Result: installRoot/node_modules/ contains all declared deps (@discordjs/voice, @buape/carbon, etc.) but no openclaw entry, so Node.js module resolution fails.

The exact same fix pattern proposed in #70462 applies here too, just in a different file: after the bundled install completes, symlink {installRoot}/node_modules/openclaw → the packageRoot computed by resolveBundledPluginPackageRoot(pluginRoot). resolveExternalBundledRuntimeDepsInstallRoot already computes packageRoot at line 324, so it's already in scope.

Expected behavior

Bundled plugins keep loading after openclaw upgrades without manual intervention.

Actual behavior

Bundled plugin whose bundle references openclaw/plugin-sdk/* crashes on every gateway start until the user manually symlinks.

Workaround (confirmed fixes Discord on 2026.4.22)

ln -s /usr/lib/openclaw \
  ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.22-<hash>/node_modules/openclaw
openclaw gateway restart

The symlink survives until the next openclaw upgrade (new <version>-<hash> directory → empty node_modules again), so it's a temporary unblock, not a fix.

Happy to open a PR

The change is small and localised in ensureBundledPluginRuntimeDeps (or right after installBundledRuntimeDeps returns): after install(...), if installRoot !== packageRoot, ensure {installRoot}/node_modules/openclaw symlinks to packageRoot. Would be good to mirror the test in #70462 but for bundled-runtime-deps.test.ts.

Happy to send a PR if no one else is already on it — just drop a note.

Environment

  • OpenClaw 2026.4.22 (commit 00bd2cf)
  • Arch Linux, systemd user service, openclaw installed to /usr/lib/openclaw (non-writable by user)
  • Node.js 22
  • Affected plugin: @openclaw/discord 2026.4.20 (bundled)

extent analysis

TL;DR

The issue can be fixed by symlinking the openclaw package in the node_modules directory of the plugin runtime dependencies to the package root.

Guidance

  • The root cause of the issue is that the openclaw package is not declared as a dependency in the Discord plugin's package.json, but the bundled output files contain imports from openclaw/plugin-sdk/*.
  • To verify the issue, check the node_modules directory of the plugin runtime dependencies for the presence of the openclaw package.
  • To mitigate the issue, create a symlink from {installRoot}/node_modules/openclaw to the package root computed by resolveBundledPluginPackageRoot(pluginRoot).
  • The fix involves modifying the ensureBundledPluginRuntimeDeps function to create the symlink after installing the bundled runtime dependencies.

Example

ln -s /usr/lib/openclaw \
  ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.22-<hash>/node_modules/openclaw

Notes

  • The proposed fix is similar to the one in #70462, but applies to a different file.
  • The symlink will need to be recreated after each openclaw upgrade.

Recommendation

Apply the workaround by creating the symlink, and consider submitting a PR to implement the fix in the ensureBundledPluginRuntimeDeps function.

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

Bundled plugins keep loading after openclaw upgrades without manual intervention.

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]: bundled plugin runtime-deps don't link openclaw, so Discord/Telegram/etc. crash on 2026.4.22 with 'Cannot find package openclaw' [1 comments, 1 participants]