openclaw - 💡(How to fix) Fix Telegram channel fails to start in 4.29: bundled bare-import of json5 (no exports field) + plugin staging clobbers local patches [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#75865Fetched 2026-05-02 05:28:44
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
closed ×1commented ×1

OpenClaw 2026.4.29 bundled output uses bare-specifier import "json5" from ESM context. [email protected] (current latest) has no "exports" field in its package.json, so modern Node's strict ESM resolution rejects the bare specifier with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'json5' imported from
  /home/johnny/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-<hash>/dist/frontmatter-Cc-V8aI2.js
Did you mean to import "json5/lib/index.js"?

This blocks the Telegram channel from starting on a fresh OpenClaw 4.29 install. The Telegram channel loader transitively imports frontmatter-Cc-V8aI2.js which uses bare import JSON5 from "json5".

Error Message

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'json5' imported from 5. Auto-restart loop triggers but never recovers (same error every retry)

Root Cause

OpenClaw 2026.4.29 bundled output uses bare-specifier import "json5" from ESM context. [email protected] (current latest) has no "exports" field in its package.json, so modern Node's strict ESM resolution rejects the bare specifier with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'json5' imported from
  /home/johnny/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-<hash>/dist/frontmatter-Cc-V8aI2.js
Did you mean to import "json5/lib/index.js"?

This blocks the Telegram channel from starting on a fresh OpenClaw 4.29 install. The Telegram channel loader transitively imports frontmatter-Cc-V8aI2.js which uses bare import JSON5 from "json5".

Fix Action

Fix / Workaround

Issue: Bundled import "json5" fails strict ESM resolution; staging clobbers any local patches

Why local patches don't help

But every gateway restart triggers [plugins] staging bundled runtime deps before gateway startup, which deletes node_modules/json5/ and reinstalls fresh from npm, clobbering the patch. So the issue cannot be worked around at the install layer.

Code Example

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'json5' imported from
  /home/johnny/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-<hash>/dist/frontmatter-Cc-V8aI2.js
Did you mean to import "json5/lib/index.js"?

---

dist/register.setup-C0hIbv0J.js
dist/bundle-manifest-CcRc3pxB.js
dist/parse-json-compat-g9wpnFYm.js
dist/redact-vz8FmIJK.js
dist/frontmatter-Cc-V8aI2.jsTelegram-blocking path
dist/includes-scan-B8MfjWj8.js
dist/state-migrations-CbUcO0eO.js
dist/status.gather-CF0k_g9-.js
dist/facade-activation-check.runtime.js
dist/redact-snapshot-yy2L2LOA.js
dist/config-cli-CJmqioRD.js
dist/includes-hF8-lKny.js
dist/io-DaEsZ_NY.js
dist/exec-approvals-cli-CWPtNC6Z.js
plugin-sdk/src/config/io.d.ts

---

$ cd plugin-runtime-deps/openclaw-2026.4.29-<hash>/dist && \
  node --input-type=module -e 'import("json5").then(m => console.log("OK"))'
OK

---

- import JSON5 from "json5";
+ import JSON5 from "json5/lib/index.js";
RAW_BUFFERClick to expand / collapse

Issue: Bundled import "json5" fails strict ESM resolution; staging clobbers any local patches

Summary

OpenClaw 2026.4.29 bundled output uses bare-specifier import "json5" from ESM context. [email protected] (current latest) has no "exports" field in its package.json, so modern Node's strict ESM resolution rejects the bare specifier with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'json5' imported from
  /home/johnny/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-<hash>/dist/frontmatter-Cc-V8aI2.js
Did you mean to import "json5/lib/index.js"?

This blocks the Telegram channel from starting on a fresh OpenClaw 4.29 install. The Telegram channel loader transitively imports frontmatter-Cc-V8aI2.js which uses bare import JSON5 from "json5".

Reproduction

  1. Install OpenClaw 4.29 globally via pnpm
  2. Configure a Telegram channel
  3. Start the gateway
  4. Watch journal: Telegram channel exits at startup with Cannot find package 'json5'
  5. Auto-restart loop triggers but never recovers (same error every retry)

Affected files

15 files in dist/ use bare-specifier import "json5":

dist/register.setup-C0hIbv0J.js
dist/bundle-manifest-CcRc3pxB.js
dist/parse-json-compat-g9wpnFYm.js
dist/redact-vz8FmIJK.js
dist/frontmatter-Cc-V8aI2.js              ← Telegram-blocking path
dist/includes-scan-B8MfjWj8.js
dist/state-migrations-CbUcO0eO.js
dist/status.gather-CF0k_g9-.js
dist/facade-activation-check.runtime.js
dist/redact-snapshot-yy2L2LOA.js
dist/config-cli-CJmqioRD.js
dist/includes-hF8-lKny.js
dist/io-DaEsZ_NY.js
dist/exec-approvals-cli-CWPtNC6Z.js
plugin-sdk/src/config/io.d.ts

Why local patches don't help

Adding an "exports" field to the staged node_modules/json5/package.json works while it's there:

$ cd plugin-runtime-deps/openclaw-2026.4.29-<hash>/dist && \
  node --input-type=module -e 'import("json5").then(m => console.log("OK"))'
OK

But every gateway restart triggers [plugins] staging bundled runtime deps before gateway startup, which deletes node_modules/json5/ and reinstalls fresh from npm, clobbering the patch. So the issue cannot be worked around at the install layer.

Proposed fixes (in order of preference)

A. Stop bare-importing packages without exports fields

Change the bundled output to use explicit subpath imports for json5:

- import JSON5 from "json5";
+ import JSON5 from "json5/lib/index.js";

This works regardless of the package's exports field state. Same fix for the other 14 bundle files. Likely the bundler config (rollup/esbuild?) needs external: ["json5/lib/index.js"] or equivalent.

B. Run patch-package (or equivalent) post-stage

Have the plugin-staging step run a post-install patch that adds an "exports" field to known-bare-import-incompatible packages. Centralized. Survives staging cycles.

C. Track which deps need this in package.json

If openclaw bundler controls the package.json written for the runtime-deps install, set overrides for json5 (and similar packages) to a fork that includes the exports field.

Won't work

Pinning to an older json5 — version 1.x doesn't have exports either, and the underlying bug is the bare-import + missing-exports combination, not version-specific.

Environment

  • OpenClaw: 2026.4.29 (a448042)
  • Install: pnpm global at ~/.local/share/pnpm/global/5/.pnpm/[email protected].../node_modules/openclaw/
  • Node: 22.22.0
  • OS: Linux 6.8.0-110-generic (Ubuntu)
  • VPS provider: Hostinger
  • Telegram channel: @kansologic_v2bot, dmPolicy=pairing, groupPolicy=allowlist
  • Discord channel: temporarily disabled to break unrelated CPU death-spiral
  • json5 package version: 2.2.3 (current latest on npm)

Severity

High for users running with Telegram channel enabled on a fresh 4.29 install. Bot fails to start; auto-restart loop never recovers without upstream fix or persistent local patch (which gets clobbered on every gateway restart).

Related observations during diagnosis

  • [plugins] document-extract, runway, tts-local-cli, acpx, memory-core all stage the same 46-spec dep tree on each gateway start. Repeated work / churn.
  • JSON5: '
' in strings is not valid ECMAScript; consider escaping warnings appear at startup — possibly an unrelated issue with internal JSON5 parsing of ~/.openclaw/openclaw.json itself.

extent analysis

TL;DR

Change the bundled output to use explicit subpath imports for json5, such as import JSON5 from "json5/lib/index.js";, to resolve the issue with strict ESM resolution.

Guidance

  • Identify all files using bare-specifier import "json5" and update them to use explicit subpath imports.
  • Consider updating the bundler config (e.g., rollup or esbuild) to include external: ["json5/lib/index.js"] or equivalent.
  • As an alternative, explore using patch-package or equivalent to add an "exports" field to known-bare-import-incompatible packages.
  • Verify the fix by checking that the Telegram channel starts successfully and the auto-restart loop is resolved.

Example

- import JSON5 from "json5";
+ import JSON5 from "json5/lib/index.js";

This change can be applied to the 15 affected files in the dist/ directory.

Notes

The proposed fixes assume that the bundler config can be updated to accommodate the changes. Additionally, the patch-package approach may require centralized management to ensure consistency across different environments.

Recommendation

Apply workaround A, which involves changing the bundled output to use explicit subpath imports for json5, as it is a more straightforward and targeted solution that addresses the root cause of the issue.

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 Telegram channel fails to start in 4.29: bundled bare-import of json5 (no exports field) + plugin staging clobbers local patches [1 comments, 2 participants]