Skip to content

openclaw update can fail with missing dist chunk after stale ACPX dependency leaves build output incomplete #70217

Description

@vijayanandmit

Summary

openclaw update failed at CLI startup with ERR_MODULE_NOT_FOUND because the local dist/ tree had been cleaned and only partially rebuilt.

The underlying cause was a stale installed acpx package version in node_modules that no longer matched extensions/acpx/package.json or pnpm-lock.yaml.

Observed failure

Running openclaw update produced:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/ge-admin/openclaw/dist/is-main-Bv5ej4lF.js' imported from /home/ge-admin/openclaw/dist/entry.js

Node version at the time: v22.22.0.

Root cause

The ACPX extension declared [email protected] in extensions/acpx/package.json, and the lockfile also resolved [email protected], but the installed package in node_modules/acpx was still 0.4.0.

That older installed version did not export acpx/runtime.

During rebuild, this caused pnpm build to fail in the ACPX extension with a resolution error from extensions/acpx/src/runtime.ts:

Could not resolve 'acpx/runtime' in extensions/acpx/src/runtime.ts
Package subpath is not defined by exports

Because the build pipeline had already cleaned dist/, the failed rebuild left the root CLI output incomplete. After that, openclaw update crashed on startup because dist/entry.js still referenced hashed chunk files that were no longer present.

Failure chain

  1. Installed dependency state drifted from the lockfile/package manifest.
  2. [email protected] remained in node_modules.
  3. pnpm build failed when ACPX code imported acpx/runtime.
  4. dist/ had already been cleaned, so the failed build left root CLI artifacts incomplete.
  5. openclaw update attempted to start from the broken local CLI bundle and failed with ERR_MODULE_NOT_FOUND on a missing hashed chunk.

Recovery that worked

A targeted reinstall followed by rebuild restored the CLI:

pnpm install --filter ./extensions/acpx
pnpm build

After that:

  • node -e "import('./dist/entry.js')" succeeded
  • openclaw update started normally again

Why this matters

The immediate dependency mismatch is local-state drift, but the user-facing failure mode is poor:

  • the actual actionable problem is an out-of-sync install / failed build
  • the surfaced error is instead a low-level missing hashed chunk under dist/
  • the updater gives no direct hint that the local build output is incomplete or that ACPX/package reinstall may be required

Suggested follow-ups

Any of these would improve the experience:

  1. Detect incomplete root CLI build output before startup and fail with a targeted message instead of a raw missing-chunk import error.
  2. Add a doctor or updater preflight that can detect manifest/lockfile vs installed-package drift for bundled plugin runtime dependencies.
  3. Make the updater surface rebuild guidance when local dist/entry.js or required sibling chunks are missing.
  4. Consider a more atomic build/update flow so a failed rebuild does not strand the repo in a half-built CLI state.

Local verification details

Checked during triage:

  • extensions/acpx/package.json expected [email protected]
  • pnpm-lock.yaml also resolved [email protected]
  • installed node_modules/acpx/package.json was 0.4.0 before reinstall
  • 0.4.0 exports did not include ./runtime
  • 0.5.3 exports do include ./runtime

Scope note

This issue is not claiming the ACPX source import is wrong. The import is valid for the declared package version. The bug is the operational failure mode when the installed dependency graph is stale and a failed rebuild leaves dist/ unusable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions