Skip to content

Web UI "Update" button corrupts installation — missing core files, gateway unable to start #62984

@xl0shk

Description

@xl0shk

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

  1. Run OpenClaw gateway normally (openclaw gateway)
  2. Open the Web UI (canvas)
  3. Click the "Update" button
  4. 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:

npm install -g openclaw

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:

  1. Atomic swap: Download and extract the new version to a temporary directory, verify integrity, then rename/swap the directories in a single operation.
  2. Rollback support: Keep a backup of the old installation until the new version is verified to be working, and restore it on failure.
  3. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions