Description
Clicking the "Update" button in the OpenClaw Web UI results in a corrupted installation. After the update process runs, most core files are deleted and the gateway cannot start.
Steps to Reproduce
- Run OpenClaw gateway normally (
openclaw gateway)
- Open the Web UI (canvas)
- Click the "Update" button
- Gateway crashes and
openclaw CLI becomes unavailable
Expected Behavior
OpenClaw should update to the new version seamlessly, or roll back to the previous version if the update fails.
Actual Behavior
The update process appears to delete the old installation before the new version is fully written. The result is a broken installation:
Missing files
package.json — completely absent
dist/index.js — the main entry point, absent
bin/ directory — absent
/opt/homebrew/bin/openclaw symlink — removed
Remaining files
Only partial directory skeletons remain:
/opt/homebrew/lib/node_modules/openclaw/
├── dist/
│ └── extensions/ # only empty subdirectories (amazon-bedrock, discord, diffs, etc.)
└── node_modules/
└── @img, @lydell, @mariozechner, @napi-rs, @types # all empty
Error log
Gateway repeatedly crashes with:
Error: Cannot find module '/opt/homebrew/lib/node_modules/openclaw/dist/index.js'
at Function._resolveFilename (node:internal/modules/cjs/loader:1405:15)
...
code: 'MODULE_NOT_FOUND',
requireStack: []
Workaround
Manually reinstall via npm:
The ~/.openclaw config directory is unaffected, so no data is lost.
Root Cause Analysis
The self-update mechanism seems to perform a non-atomic replacement: it removes the old installation files first, then writes the new ones. If the write phase fails or is interrupted for any reason, the installation is left in an unrecoverable "half-deleted" state.
Suggested Fix
Consider one of the following approaches:
- Atomic swap: Download and extract the new version to a temporary directory, verify integrity, then rename/swap the directories in a single operation.
- Rollback support: Keep a backup of the old installation until the new version is verified to be working, and restore it on failure.
- Use
npm install -g: Delegate the update to npm itself, which already handles atomic replacement.
Environment
- OpenClaw version: updating to 2026.4.8 (version before update unknown)
- Install method:
npm install -g openclaw
- Install path:
/opt/homebrew/lib/node_modules/openclaw/
- OS: macOS 14.5 (Sonoma), Apple Silicon
- Node.js: v23.11.0
- npm: 10.9.2
Description
Clicking the "Update" button in the OpenClaw Web UI results in a corrupted installation. After the update process runs, most core files are deleted and the gateway cannot start.
Steps to Reproduce
openclaw gateway)openclawCLI becomes unavailableExpected Behavior
OpenClaw should update to the new version seamlessly, or roll back to the previous version if the update fails.
Actual Behavior
The update process appears to delete the old installation before the new version is fully written. The result is a broken installation:
Missing files
package.json— completely absentdist/index.js— the main entry point, absentbin/directory — absent/opt/homebrew/bin/openclawsymlink — removedRemaining files
Only partial directory skeletons remain:
Error log
Gateway repeatedly crashes with:
Workaround
Manually reinstall via npm:
The
~/.openclawconfig directory is unaffected, so no data is lost.Root Cause Analysis
The self-update mechanism seems to perform a non-atomic replacement: it removes the old installation files first, then writes the new ones. If the write phase fails or is interrupted for any reason, the installation is left in an unrecoverable "half-deleted" state.
Suggested Fix
Consider one of the following approaches:
npm install -g: Delegate the update to npm itself, which already handles atomic replacement.Environment
npm install -g openclaw/opt/homebrew/lib/node_modules/openclaw/