openclaw - 💡(How to fix) Fix Runtime fails to resolve json5 package entrypoint in plugin runtime deps [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#75876Fetched 2026-05-02 05:28:36
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
closed ×1commented ×1

OpenClaw's generated plugin runtime imports json5 as a bare package import, but the runtime/module resolution path appears to look for node_modules/json5/index.js. [email protected] does not ship a top-level index.js; its CommonJS entrypoint is lib/index.js, declared via package.json as "main": "lib/index.js".

This causes agents/channels to fail before replying after gateway startup.

Error Message

Agent failed before reply: Cannot find package '/Users/agentkomers/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-da6bdffc3d96/node_modules/json5/index.js' imported from /Users/agentkomers/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-da6bdffc3d96/dist/parse-json-compat-g9wpnFYm.js
Did you mean to import "json5/lib/index.js"?.
Logs: openclaw logs --follow

A later gateway log showed the same resolution issue from another generated runtime file:

[telegram] [default] channel exited: Cannot find package 'json5' imported from /Users/agentkomers/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-da6bdffc3d96/dist/redact-vz8FmIJK.js
Did you mean to import "json5/lib/index.js"?

Root Cause

OpenClaw's generated plugin runtime imports json5 as a bare package import, but the runtime/module resolution path appears to look for node_modules/json5/index.js. [email protected] does not ship a top-level index.js; its CommonJS entrypoint is lib/index.js, declared via package.json as "main": "lib/index.js".

This causes agents/channels to fail before replying after gateway startup.

Fix Action

Workaround

Either of these local cache patches unblocked the runtime:

// node_modules/json5/index.js
module.exports = require("./lib/index.js");

or rewriting generated imports from:

import JSON5 from "json5";

to:

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

After rewriting the generated runtime imports and adding the shim, direct Node imports of the failing modules succeeded.

Code Example

Agent failed before reply: Cannot find package '/Users/agentkomers/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-da6bdffc3d96/node_modules/json5/index.js' imported from /Users/agentkomers/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-da6bdffc3d96/dist/parse-json-compat-g9wpnFYm.js
Did you mean to import "json5/lib/index.js"?.
Logs: openclaw logs --follow

---

[telegram] [default] channel exited: Cannot find package 'json5' imported from /Users/agentkomers/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-da6bdffc3d96/dist/redact-vz8FmIJK.js
Did you mean to import "json5/lib/index.js"?

---

OpenClaw runtime cache: openclaw-2026.4.29-da6bdffc3d96
json5 version: 2.2.3
json5 package main: lib/index.js

---

dist/parse-json-compat-g9wpnFYm.js
dist/redact-vz8FmIJK.js
dist/config-cli-CJmqioRD.js
dist/io-DaEsZ_NY.js
dist/state-migrations-CbUcO0eO.js

---

// node_modules/json5/index.js
module.exports = require("./lib/index.js");

---

import JSON5 from "json5";

---

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

Summary

OpenClaw's generated plugin runtime imports json5 as a bare package import, but the runtime/module resolution path appears to look for node_modules/json5/index.js. [email protected] does not ship a top-level index.js; its CommonJS entrypoint is lib/index.js, declared via package.json as "main": "lib/index.js".

This causes agents/channels to fail before replying after gateway startup.

Error

Agent failed before reply: Cannot find package '/Users/agentkomers/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-da6bdffc3d96/node_modules/json5/index.js' imported from /Users/agentkomers/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-da6bdffc3d96/dist/parse-json-compat-g9wpnFYm.js
Did you mean to import "json5/lib/index.js"?.
Logs: openclaw logs --follow

A later gateway log showed the same resolution issue from another generated runtime file:

[telegram] [default] channel exited: Cannot find package 'json5' imported from /Users/agentkomers/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-da6bdffc3d96/dist/redact-vz8FmIJK.js
Did you mean to import "json5/lib/index.js"?

Environment / observed paths

OpenClaw runtime cache: openclaw-2026.4.29-da6bdffc3d96
json5 version: 2.2.3
json5 package main: lib/index.js

Files observed importing bare json5 included:

dist/parse-json-compat-g9wpnFYm.js
dist/redact-vz8FmIJK.js
dist/config-cli-CJmqioRD.js
dist/io-DaEsZ_NY.js
dist/state-migrations-CbUcO0eO.js

Expected behavior

The plugin runtime should resolve json5 using normal package resolution, honoring json5/package.json's main field, or generated runtime files should import the real shipped entrypoint explicitly.

Actual behavior

The runtime attempts to import/resolve json5/index.js, which is not present in [email protected], causing the agent/channel to fail before replying.

Workaround

Either of these local cache patches unblocked the runtime:

// node_modules/json5/index.js
module.exports = require("./lib/index.js");

or rewriting generated imports from:

import JSON5 from "json5";

to:

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

After rewriting the generated runtime imports and adding the shim, direct Node imports of the failing modules succeeded.

Possible fix

Either:

  1. Adjust OpenClaw's runtime/package resolver to honor package entrypoints (main/exports) for bare package imports, or
  2. Generate imports for json5 as json5/lib/index.js where these runtime files are bundled.

extent analysis

TL;DR

The issue can be resolved by adjusting the import statements for json5 to use the correct entrypoint json5/lib/index.js instead of the bare package import.

Guidance

  • Verify that the json5 package version is indeed 2.2.3 and that the main field in its package.json points to lib/index.js.
  • Update the generated runtime files to import json5 using the correct entrypoint, e.g., import JSON5 from "json5/lib/index.js";.
  • Alternatively, create a shim file node_modules/json5/index.js with the content module.exports = require("./lib/index.js"); to redirect imports to the correct entrypoint.
  • Test the updated runtime files to ensure that the agent/channel no longer fails before replying.

Example

// Before
import JSON5 from "json5";

// After
import JSON5 from "json5/lib/index.js";

Notes

The issue is specific to the json5 package version 2.2.3 and may not affect other versions. The workaround or fix should be applied to the generated runtime files or the json5 package installation.

Recommendation

Apply the workaround by updating the generated runtime files to import json5 using the correct entrypoint, as this is a more targeted solution that does not require modifying the json5 package installation.

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

The plugin runtime should resolve json5 using normal package resolution, honoring json5/package.json's main field, or generated runtime files should import the real shipped entrypoint explicitly.

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 Runtime fails to resolve json5 package entrypoint in plugin runtime deps [1 comments, 2 participants]