Why update an OpenClaw install with `openclaw update` instead of re-running `npm install -g openclaw@latest`, and what does it still not protect?
answer
- who coordinates with the running service?
- the candidate is checked before the swap
- Doctor runs before activation
- rollback only when schemas did not move
- a config copy is not a backup
basics
~20 sopenclaw update detects the install type, checks the new version while the old Gateway keeps serving, runs Doctor, swaps the package, then restarts and verifies the service. A bare npm reinstall replaces files under a running Gateway. Neither replaces a verified full-state backup.
solid answer
~50 s`openclaw update` detects whether the install is npm, pnpm, Bun or git, stages the target and checks config, database schemas, the Node requirement and plugin availability while the old Gateway still serves. Doctor runs before activation, then the package is swapped and the managed service is restarted and verified to report the expected version; if that verification fails and no database schema moved, it rolls back to the previous package, service definition and exact config bytes. A manual `npm i -g openclaw@latest --allow-scripts=openclaw` does none of that: stop the managed Gateway first, then run `openclaw doctor`, `openclaw gateway restart` and `openclaw health`. What `openclaw update` keeps is an automatic pre-update config copy, not a full-state recovery point, so take a verified backup before a significant update. In 2026.9.9, installs older than June 2026 must step through 2026.9.5 first.
go deeper
Remember that openclaw update is the supported way to upgrade, and that it restarts and checks the Gateway for you when it runs as a managed service.
Explain the update pipeline, detect, stage and admit, Doctor before activation, swap, restart and verify, and what --dry-run, --channel, --tag and --no-restart change.
Know the limits: rollback is automatic only when no schema moved, a config copy is not a backup, manual npm needs a stopped Gateway plus Doctor and restart, and very old installs must bridge through 2026.9.5.
Make the backup-before-update step and the version bridge part of the documented upgrade procedure for every install you own, instead of trusting the updater's partial safety net.
## Two ways to get new bits, very different guarantees OpenClaw is distributed as an npm package (or a git checkout), so it is tempting to update it like any global tool: `npm install -g openclaw@latest`. That does put new files on disk. But an OpenClaw install is not just files: there is a **Gateway** process running from them under a service manager, SQLite databases with schema versions, a JSON5 config whose keys get migrated between releases, and plugins that must match the core. `openclaw update` exists to coordinate all of that; a bare package-manager reinstall coordinates none of it. ## What `openclaw update` does 1. **Detects the install type**: npm, pnpm, Bun or a git checkout, including custom npm prefixes. 2. **Stages and admits the candidate** while the old Gateway keeps serving: config read and validated with the new schema, database schema preflight, the Node engine requirement and plugin availability. 3. **Runs Doctor before activation**, so config migrations and startup-required repairs happen under the updater's control. 4. **Swaps the package and restarts** the managed service, then verifies that the restarted service reports the expected version and build. 5. **Rolls back automatically, but only when it is schema-neutral**: if verification fails and the shared and per-agent SQLite schema versions still match their pre-activation values, it restores the previous package, command shim, service definition and the exact pre-activation config bytes, then re-verifies the old Gateway. Useful flags: - `--dry-run` previews channel, target and restart flow without changing anything; - `--channel <stable|extended-stable|beta|dev>` changes the channel and persists it; - `--tag <dist-tag|version>` overrides the target for this update only; - `--no-restart` skips the service restart, leaving you to restart deliberately. The managed restart only applies to a managed service. A Gateway you started by hand in a terminal, or one under an external supervisor, has to be restarted through whoever owns it; on Linux hosts without systemd the update continues with a warning and skips the restart. ## What a manual npm reinstall leaves to you Package managers replace files in place. A running Gateway can then load core or plugin files halfway through the swap. Newer Gateways notice an installation replacement on their maintenance tick and drain and hand over to their service manager, but the documentation is explicit that this cannot prevent every failure, and older running Gateways do not gain it from files installed underneath them. So the manual route is: - stop the managed Gateway first (`openclaw gateway stop`); - run the install (`npm i -g openclaw@latest --allow-scripts=openclaw` on npm 12 or 11.16+); - run `openclaw doctor` to migrate config and check health; - `openclaw gateway restart`, then `openclaw health` to verify. The installer script is a third route: re-running it on an existing install runs `openclaw doctor --fix` and verifies before printing success. Container images are a fourth: pull the new image and recreate the container with the same state mounts; the image entrypoint runs Doctor before starting the Gateway. ## What no updater protects | Protection | `openclaw update` | Manual npm | |---|---|---| | Checks the candidate before the swap | yes | no | | Doctor migrations before start | yes | only if you run it | | Restart and version verification | yes, for a managed service | only if you do it | | Automatic rollback | only when schemas did not move | no | | Full-state recovery point | **no** | **no** | `openclaw update` keeps an automatic pre-update **config copy** and, during the run, pre-migration database snapshots that are removed after a verified activation. Neither is a full-state backup. Once a release has migrated a database schema, swapping the old package back cannot reverse it. The documented practice is to create an independent **verified backup** of the state directory before a significant update, stored with the same protection as the live state because it contains credentials. ## The version bridge This answer assumes OpenClaw 2026.9.9. Its update guide says installations older than June 2026 must upgrade to **2026.9.5 first**, run that release's Doctor migrations (which still import retired task, flow, plugin-state and OAuth files and repair retired config keys), and only then move to `latest`. Current releases leave those retired files untouched, and Doctor stops before rewriting config that still carries the retired keys.
- What is the difference between `openclaw update --channel beta` and `openclaw update --tag beta`?`--channel beta` changes the update policy: it is saved as `update.channel` after a successful core update, so later manual and automatic updates follow beta. `--tag beta` overrides the package target for this one run only; a saved channel keeps governing later updates, even after a one-off beta install.
- An `openclaw update` failed verification after a database migration ran. Why did it not roll back automatically?Automatic rollback is limited to schema-neutral cases: it compares SQLite schema versions with their pre-activation values and refuses when any changed, because the old package cannot read a newer schema and replacing the package alone cannot reverse a migration. Recovery then goes through Doctor's guidance or a verified pre-update backup restored with its matching release.
- openclaw update makes a full backup, so a separate backup is redundant
- npm install -g is equivalent because npm restarts the service
- A failed update can always be rolled back by reinstalling the old version
- --tag beta switches the install to the beta channel for good
- Any old install can jump straight to the latest release
Assumes OpenClaw 2026.9.9, whose update guide routes installs older than June 2026 through the 2026.9.5 bridge release first.