openclaw - ✅(Solved) Fix @openclaw/codex 2026.5.18 can fail with ERR_MODULE_NOT_FOUND for package 'openclaw' unless openclaw is installed locally [1 pull requests, 2 comments, 3 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#83964Fetched 2026-05-20 03:45:53
View on GitHub
Comments
2
Participants
3
Timeline
10
Reactions
1
Timeline (top)
labeled ×6commented ×2cross-referenced ×2

While recovering an OpenClaw 2026.5.18 install, the Codex harness failed with:

Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js

Installing [email protected] into /Users/openclaw/.openclaw/npm fixed this error.

This suggests @openclaw/codex may depend on the openclaw package at runtime but not reliably install it in this local npm environment.

Error Message

2026-05-19T11:52:14.329+09:00 warn agents/harness {"harnessId":"codex","provider":"openai-codex","modelId":"gpt-5.5","error":"Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js"} Codex agent harness failed; not falling back to embedded PI backend 2026-05-19T11:52:14.353+09:00 error diagnostic lane task error: lane=main durationMs=16919 error="Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js" 2026-05-19T11:52:54.100+09:00 info gateway/ws ⇄ res ✗ agent errorCode=UNAVAILABLE errorMessage=Error: Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js: code=ERR_MODULE_NOT_FOUND

Root Cause

While recovering an OpenClaw 2026.5.18 install, the Codex harness failed with:

Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js

Installing [email protected] into /Users/openclaw/.openclaw/npm fixed this error.

This suggests @openclaw/codex may depend on the openclaw package at runtime but not reliably install it in this local npm environment.

Fix Action

Fix / Workaround

Workaround used

cd /Users/openclaw/.openclaw/npm
npm install [email protected]

Impact

Before the workaround, all OpenAI/Codex model attempts failed before reaching the provider, then fallback attempted other models and eventually failed.

PR fix notes

PR #84275: fix(codex): add openclaw runtime dependency

Description (problem / solution / changelog)

Summary

  • add the host openclaw package as a concrete runtime dependency for @openclaw/codex
  • keep the change scoped to extensions/codex/package.json

Why

@openclaw/codex imports openclaw/plugin-sdk/... from its published runtime bundle. When the package is installed by itself, npm installs @openclaw/codex without the openclaw package, so those bare openclaw/... imports fail at runtime.

This matches the live repro in #83964: installing @openclaw/[email protected] alone can throw ERR_MODULE_NOT_FOUND: Cannot find package 'openclaw', while installing openclaw beside it makes the same import pass.

Real behavior proof

  • Behavior or issue addressed: Standalone installs of @openclaw/codex can fail at runtime because the published bundle imports openclaw/... but the package does not install openclaw as a dependency.
  • Real environment tested: macOS local shell, Node/npm, installing the real published @openclaw/[email protected] tarball from npm into fresh temporary projects. The after-fix case repacked that same published tarball with only the dependency metadata added, matching this PR's dependency-only change. Current main is versioned 2026.5.19, which is not published as a stable npm package yet, so the live install proof uses the currently published 2026.5.18 package.
  • Exact steps or command run after this patch: Installed the published package alone in one fresh temp project, then repacked the same package with dependencies.openclaw added and installed that patched tarball alone in a second fresh temp project. In both cases I imported the real bundled dist/shared-client-DlvmoLBJ.js.
  • Evidence after fix:
WORK=/tmp/codex-proof.syMZHr
=== BEFORE: published package alone ===
npm warn deprecated [email protected]: Use your platform's native DOMException instead
BEFORE_OPENCLAW=missing
BEFORE_IMPORT=ERR_MODULE_NOT_FOUND:Cannot find package 'openclaw' imported from /private/tmp/codex-proof.syMZHr/before/node_modules/@openclaw/codex/dist/client-6FkrXfaz.js
=== PATCH PACKAGE METADATA LIKE PR ===
PATCHED_DEP=>=2026.5.18
=== AFTER: patched package alone ===
npm warn deprecated [email protected]: Use your platform's native DOMException instead
AFTER_CODEX_DEP=>=2026.5.18
AFTER_OPENCLAW_VERSION=2026.5.18
AFTER_IMPORT=ok
  • Observed result after fix: With openclaw present as a concrete dependency, npm installs node_modules/openclaw automatically and the same Codex bundled import succeeds with AFTER_IMPORT=ok.
  • What was not tested: I did not publish a new @openclaw/codex package or run a full gateway boot from the unreleased 2026.5.19 package.

Verification

  • checked for existing open PRs mentioning #83964 / Codex dependency before opening this
  • parsed extensions/codex/package.json and verified dependencies.openclaw
  • git diff --check
  • diff is intentionally small: +1/-0

Fixes #83964

Changed files

  • extensions/codex/package.json (modified, +1/-0)

Code Example

Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js

---

2026-05-19T11:52:14.329+09:00 warn agents/harness {"harnessId":"codex","provider":"openai-codex","modelId":"gpt-5.5","error":"Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js"} Codex agent harness failed; not falling back to embedded PI backend
2026-05-19T11:52:14.353+09:00 error diagnostic lane task error: lane=main durationMs=16919 error="Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js"
2026-05-19T11:52:54.100+09:00 info gateway/ws ⇄ res ✗ agent errorCode=UNAVAILABLE errorMessage=Error: Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js: code=ERR_MODULE_NOT_FOUND

---

cd /Users/openclaw/.openclaw/npm
npm install openclaw@2026.5.18

---

npm@ /Users/openclaw/.openclaw/npm
├─┬ @openclaw/codex@2026.5.18
│ ├── @openai/codex@0.131.0 overridden
│ └── openclaw@2026.5.18 deduped
└── openclaw@2026.5.18

---

codex-cli 0.131.0
RAW_BUFFERClick to expand / collapse

Summary

While recovering an OpenClaw 2026.5.18 install, the Codex harness failed with:

Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js

Installing [email protected] into /Users/openclaw/.openclaw/npm fixed this error.

This suggests @openclaw/codex may depend on the openclaw package at runtime but not reliably install it in this local npm environment.

Environment

  • OpenClaw CLI/Gateway: 2026.5.18 (50a2481)
  • Local OpenClaw npm dir: /Users/openclaw/.openclaw/npm
  • @openclaw/codex: upgraded to 2026.5.18
  • @openai/codex: overridden to 0.131.0
  • Node: v22.22.0

Failing logs

2026-05-19T11:52:14.329+09:00 warn agents/harness {"harnessId":"codex","provider":"openai-codex","modelId":"gpt-5.5","error":"Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js"} Codex agent harness failed; not falling back to embedded PI backend
2026-05-19T11:52:14.353+09:00 error diagnostic lane task error: lane=main durationMs=16919 error="Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js"
2026-05-19T11:52:54.100+09:00 info gateway/ws ⇄ res ✗ agent errorCode=UNAVAILABLE errorMessage=Error: Cannot find package 'openclaw' imported from /Users/openclaw/.openclaw/npm/node_modules/@openclaw/codex/dist/shared-client-DlvmoLBJ.js: code=ERR_MODULE_NOT_FOUND

Workaround used

cd /Users/openclaw/.openclaw/npm
npm install [email protected]

After that:

npm@ /Users/openclaw/.openclaw/npm
├─┬ @openclaw/[email protected]
│ ├── @openai/[email protected] overridden
│ └── [email protected] deduped
└── [email protected]

Codex CLI then reported:

codex-cli 0.131.0

Expected behavior

Installing/upgrading @openclaw/codex should include or declare every runtime dependency it imports, so a user does not need to manually install openclaw into the sidecar npm environment.

Impact

Before the workaround, all OpenAI/Codex model attempts failed before reaching the provider, then fallback attempted other models and eventually failed.

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

Installing/upgrading @openclaw/codex should include or declare every runtime dependency it imports, so a user does not need to manually install openclaw into the sidecar npm environment.

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 @openclaw/codex 2026.5.18 can fail with ERR_MODULE_NOT_FOUND for package 'openclaw' unless openclaw is installed locally [1 pull requests, 2 comments, 3 participants]