openclaw - 💡(How to fix) Fix [Bug]: Gateway startup fails after update to 2026.4.24 — ERR_MODULE_NOT_FOUND, 1617 dist files missing from installed package (postinstall pruning bug) [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#72042Fetched 2026-04-27 05:35:42
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
1
Author
Timeline (top)
closed ×1commented ×1cross-referenced ×1subscribed ×1

After updating to OpenClaw 2026.4.24 (from 2026.4.23), the gateway fails to start with ERR_MODULE_NOT_FOUND. Investigation reveals that the npm tarball contains 4116 .js files in dist/, but after installation only 2499 remain — 1617 files are silently deleted during the postinstall process. This makes the gateway completely non-functional on Linux.

Error Message

  • Completion cache update failed: Error: spawnSync /usr/bin/node ETIMEDOUT — indicates the postinstall script timed out during execution
  • Issue #70343 reports the same unsafe dist entry error in the postinstall script for 2026.4.21

Key error logs

Gateway failed to start: Error [ERR_MODULE_NOT_FOUND]: Cannot find module plugin services failed to start: Error [ERR_MODULE_NOT_FOUND]: Cannot find module startup model warmup failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module

Root Cause

The npm tarball for 2026.4.24 contains all 4116 .js files — the files are present before installation. The deletion happens during the postinstall phase.

The postinstall-bundled-plugins.mjs script uses rmSync, unlinkSync, and rmdirSync to prune files. When this script encounters errors (e.g., unsafe dist entry, ENOTEMPTY), it appears to delete files that should be kept, or fails partway through leaving the installation in a broken state.

Evidence:

  • Completion cache update failed: Error: spawnSync /usr/bin/node ETIMEDOUT — indicates the postinstall script timed out during execution
  • Issue #70343 reports the same unsafe dist entry error in the postinstall script for 2026.4.21
  • Issue #70027 reports postinstall repair crashes on unsafe dist entry

Fix Action

Workaround

Roll back to 2026.4.23:

npm install -g [email protected]
openclaw gateway restart

Code Example

Gateway failed to start: Error [ERR_MODULE_NOT_FOUND]: Cannot find module 
  /usr/lib/node_modules/openclaw/dist/restart-sentinel-BLetiNOM.js 
  imported from /usr/lib/node_modules/openclaw/dist/server.impl-CtLS1ywt.js

plugin services failed to start: Error [ERR_MODULE_NOT_FOUND]: Cannot find module 
  /usr/lib/node_modules/openclaw/dist/services-DD7sZb1Q.js 
  imported from /usr/lib/node_modules/openclaw/dist/server.impl-CtLS1ywt.js

startup model warmup failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module 
  /usr/lib/node_modules/openclaw/dist/extensions/codex/provider.js 
  imported from /usr/lib/node_modules/openclaw/dist/extensions/codex/provider-discovery.js

[channels] failed to load bundled channel telegram: ENOTEMPTY, Directory not empty: 
  /root/.openclaw/plugin-runtime-deps/openclaw-2026.4.24-.../dist/extensions/node_modules/openclaw/plugin-sdk

[channels] failed to load bundled channel qqbot: Cannot find module 
  /root/.openclaw/plugin-runtime-deps/openclaw-unknown-.../dist/plugin-sdk/cli-runtime.js

---

npm install -g openclaw@2026.4.23
openclaw gateway restart
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

After updating to OpenClaw 2026.4.24 (from 2026.4.23), the gateway fails to start with ERR_MODULE_NOT_FOUND. Investigation reveals that the npm tarball contains 4116 .js files in dist/, but after installation only 2499 remain — 1617 files are silently deleted during the postinstall process. This makes the gateway completely non-functional on Linux.

Steps to reproduce

  1. Have a working OpenClaw 2026.4.23 installation on Linux (Ubuntu 24.04, Node 24.14.0)
  2. Run openclaw update to update to 2026.4.24
  3. Gateway restarts and immediately fails with ERR_MODULE_NOT_FOUND
  4. Observe that critical dist files like restart-sentinel-BLetiNOM.js, services-DD7sZb1Q.js, and codex/provider.js are missing from /usr/lib/node_modules/openclaw/dist/

Four attempted recoveries — all failed

AttemptActionResult
1stUpdate to 2026.4.24, auto-restartGateway startup_failed. Only ~172 dist files present. ERR_MODULE_NOT_FOUND for server-restart-sentinel-mQedG9j5.js.
2ndRoll back to 2026.4.23, then update again to 2026.4.24Dist files appear complete (2499), but gateway is unresponsive — health check times out (3000ms), WebSocket handshake times out (10s+). Multiple bundled channels fail with ENOTEMPTY and Cannot find module in plugin-runtime-deps.
3rdClean plugin-runtime-deps cache, update to 2026.4.24 againSame result: gateway starts but is unresponsive. plugin-runtime-deps recreated with broken symlinks pointing to non-existent files.
4thFull update attempt againSame: ERR_MODULE_NOT_FOUND for restart-sentinel-BLetiNOM.js, services-DD7sZb1Q.js, codex/provider.js. Gateway startup_failed.

Rolling back to 2026.4.23 restores full functionality every time.

Expected behavior

  • openclaw update should leave the installation in a working state
  • All 4116 dist files from the npm tarball should be present after installation
  • Gateway should start successfully after update

Actual behavior

  • Update claims success but leaves installation broken
  • 1617 of 4116 dist files are missing after installation
  • Gateway fails with ERR_MODULE_NOT_FOUND on every startup attempt
  • plugin-runtime-deps directories contain broken symlinks pointing to missing files
  • Multiple bundled channels fail to initialize (ENOTEMPTY errors during runtime dep setup)
  • Even when dist file count appears correct (2499), gateway is unresponsive (health check timeout, WebSocket handshake timeout)

Root cause analysis

The npm tarball for 2026.4.24 contains all 4116 .js files — the files are present before installation. The deletion happens during the postinstall phase.

The postinstall-bundled-plugins.mjs script uses rmSync, unlinkSync, and rmdirSync to prune files. When this script encounters errors (e.g., unsafe dist entry, ENOTEMPTY), it appears to delete files that should be kept, or fails partway through leaving the installation in a broken state.

Evidence:

  • Completion cache update failed: Error: spawnSync /usr/bin/node ETIMEDOUT — indicates the postinstall script timed out during execution
  • Issue #70343 reports the same unsafe dist entry error in the postinstall script for 2026.4.21
  • Issue #70027 reports postinstall repair crashes on unsafe dist entry

Key error logs

Gateway failed to start: Error [ERR_MODULE_NOT_FOUND]: Cannot find module 
  /usr/lib/node_modules/openclaw/dist/restart-sentinel-BLetiNOM.js 
  imported from /usr/lib/node_modules/openclaw/dist/server.impl-CtLS1ywt.js

plugin services failed to start: Error [ERR_MODULE_NOT_FOUND]: Cannot find module 
  /usr/lib/node_modules/openclaw/dist/services-DD7sZb1Q.js 
  imported from /usr/lib/node_modules/openclaw/dist/server.impl-CtLS1ywt.js

startup model warmup failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module 
  /usr/lib/node_modules/openclaw/dist/extensions/codex/provider.js 
  imported from /usr/lib/node_modules/openclaw/dist/extensions/codex/provider-discovery.js

[channels] failed to load bundled channel telegram: ENOTEMPTY, Directory not empty: 
  /root/.openclaw/plugin-runtime-deps/openclaw-2026.4.24-.../dist/extensions/node_modules/openclaw/plugin-sdk

[channels] failed to load bundled channel qqbot: Cannot find module 
  /root/.openclaw/plugin-runtime-deps/openclaw-unknown-.../dist/plugin-sdk/cli-runtime.js

OpenClaw version

2026.4.24

Operating system

Ubuntu 24.04.2 LTS (Linux 6.8.0-110-generic x86_64)

Install method

npm global (npm install -g openclaw)

Workaround

Roll back to 2026.4.23:

npm install -g [email protected]
openclaw gateway restart

Related issues

  • #72040 — Telegram channel crash on Windows 11 in 2026.4.24 (grammY deps missing, same root cause)
  • #70343 — 2026.4.21 update leaves broken install (postinstall fails on unsafe dist entry)
  • #70027 — Bundled plugin postinstall repair crashes on unsafe dist entry
  • #71994 — Gateway startup probes bundled WhatsApp runtime deps and can hang/delay restarts

extent analysis

TL;DR

The most likely fix is to modify the postinstall-bundled-plugins.mjs script to handle errors more robustly and prevent file deletion during the postinstall phase.

Guidance

  1. Review the postinstall-bundled-plugins.mjs script: Investigate how the script handles errors, such as unsafe dist entry and ENOTEMPTY, to understand why files are being deleted.
  2. Implement error handling: Modify the script to catch and log errors instead of deleting files, ensuring that the installation remains in a consistent state.
  3. Verify file presence: After updating, check that all 4116 dist files are present in the /usr/lib/node_modules/openclaw/dist/ directory.
  4. Test gateway startup: Restart the gateway and verify that it starts successfully without any ERR_MODULE_NOT_FOUND errors.

Example

// Modified postinstall-bundled-plugins.mjs script
try {
  // existing code
} catch (error) {
  console.error('Error during postinstall:', error);
  // Log the error instead of deleting files
}

Notes

The provided workaround of rolling back to 2026.4.23 may not be a long-term solution, and addressing the root cause in the postinstall-bundled-plugins.mjs script is necessary for a stable update process.

Recommendation

Apply the workaround of rolling back to 2026.4.23 until a fixed version of OpenClaw is released, as it is the most reliable way to ensure a working 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

  • openclaw update should leave the installation in a working state
  • All 4116 dist files from the npm tarball should be present after installation
  • Gateway should start successfully after update

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING