Repository navigation
Description
2026.7.1 startup-migration gate is fatal, but the repair path (openclaw doctor) doesn't resolve the conflict — gateway crash-loops with no documented remedy
Summary
Upgrading a long-lived install to 2026.7.1 left the gateway refusing to start, crash-looping under launchd, with:
[openclaw] Reason: OpenClaw startup migrations did not complete cleanly; refusing to report the gateway ready.
- Left plugin install index in place because shared SQLite state has conflicting plugin install metadata for: deepseek, firecrawl, perplexity, qwen
- Left legacy update-check state in place because shared SQLite state already differs: /Users/.../.openclaw/update-check.json
- Left legacy config health state in place because 1 entry conflicts with shared SQLite state: /Users/.../.openclaw/logs/config-health.json
[openclaw] Try: openclaw doctor
The error directs the user to openclaw doctor, but doctor --fix does not resolve these conflicts — it reconciles other state (auth-profile SQLite, config) and leaves the plugin-install-index / legacy-state conflicts exactly as-is, so the gateway keeps failing the gate. There is no documented or automated way to complete the migration; the only fix I found was manually moving the conflicting legacy JSON files aside.
2026.7.1 intentionally makes an unclean migration fatal ("gateway crashes stop restarting forever / stable repair path"). The problem isn't the gate — it's that the advertised repair path doesn't repair, and three secondary issues make recovery worse (below).
Environment
- OpenClaw 2026.7.1 (
2d2ddc4), upgraded from 2026.6.11 viaopenclaw update(npm, stable). - macOS (Darwin 24.6.0), Node 25.9.0, npm-global, gateway under launchd (
KeepAlive). - Long-lived install: the state dir has
~/.openclaw/plugins/installs.json,~/.openclaw/update-check.json,~/.openclaw/logs/config-health.jsonaccumulated across many prior versions — these predate the new shared-SQLite store and conflict with the entries the migration wrote into it.
The core bug
- Startup migration finds legacy JSON state that conflicts with the new shared-SQLite store → it "leaves the legacy state in place" and marks the migration incomplete.
- The incomplete migration trips the fatal readiness gate → gateway never reports ready → launchd respawns it every ~13s (crash loop).
- The error says "Try: openclaw doctor", but
openclaw doctor --fixdoes not reconcile the plugin-install-index or legacy-state conflicts — they persist verbatim across repeateddoctor --fixruns.
Expected: doctor --fix (or openclaw update repair) should resolve legacy-vs-SQLite conflicts — e.g. adopt one side deterministically, or offer a --force-adopt-sqlite / --reset-legacy-state path — or the error should name the exact files to move and the command to run. Right now the user is told to run a tool that can't fix it, with no next step.
Three secondary issues that make recovery worse
- b1. Stale migration lease-lock under crash-loop. Once looping, starts begin failing with a different error:
The launchd respawns contend the migration lease and effectively keep it held, so it never clears within the respawn cycle. Recovery requires fully unloading the service (
OpenClaw startup migrations are already running for this state directory; retry after <timestamp>.launchctl bootout) and waiting out the lease before a single clean start. - b2.
doctor --fixrestarts the crash-looping gateway mid-repair. Runningdoctor --fixto repair the loop re-bootstraps/restarts the LaunchAgent, re-arming the crash loop and lease contention while you're trying to diagnose. A repair command shouldn't restart the unhealthy service without first resolving the cause. - b3. "Stable repair path" still thrashes. The release notes describe repeatedly-failing gateways leaving "a stable repair path instead of restarting indefinitely," but in practice launchd
KeepAliverespawned the failing process every ~13s indefinitely until manually booted out.
Workaround
launchctl bootout gui/$UID/ai.openclaw.gateway # stop the crash loop
# move the conflicting legacy state aside (regenerable caches):
mv ~/.openclaw/plugins/installs.json ~/.openclaw/plugins/installs.json.bak
mv ~/.openclaw/update-check.json ~/.openclaw/update-check.json.bak
mv ~/.openclaw/logs/config-health.json ~/.openclaw/logs/config-health.json.bak # if present
# wait out the migration lease, then ONE clean start:
openclaw gateway restartAfter this the migration completes against the SQLite store and the gateway comes up.
Impact / notes
The conflicting legacy files come from a long-lived install, which most users won't have — so the trigger is niche. But the failure mode (fatal gate + a repair path that can't repair + a crash loop that holds its own lease) is a rough first-run experience for exactly the upgrade-from-old-version case the migration exists to serve. Making doctor --fix actually reconcile these, or naming the files in the error, would resolve it.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
darealgege commentedon Jul 14, 2026
Additional context: Node version mismatch (nvm vs system) compounds the issue
I encountered the same problem today on an Ubuntu 22.04 system, but with an additional complication that made diagnosis harder.
Environment
What happened
The Node version problem
The systemd service uses /usr/bin/node (v26.5.0), but the TUI (openclaw chat) uses the nvm Node (v24.18.0). These two instances were competing for the same migration lease, and the different Node versions may have contributed to the SQLite migration inconsistency.
Suggestion: The openclaw update command should warn if multiple Node versions are detected, or the systemd service should explicitly use the same Node binary as the CLI.
Workaround that worked
Suggestions for improvement
shao-zhijie commentedon Jul 14, 2026
Three additional data points from a parallel macOS / launchd install hitting the same gate, which I think are independent of the cases already discussed and may help triangulate the bug.
1.
state_leases.expires_atfield is unit-inconsistent — the 5-min wait is a lieI hit the same lease lock you described, but the suggested
retry after 2026-07-14T09:45:20.221Zis not actually 5 minutes away. Inspectingstate_leasesin~/.openclaw/state/openclaw.sqlite:date -u -r 1784022320221decodes asSat Jun 2 11:37:01 UTC 58503, not 2026-07-14. Looks like the field is being written asDate.now()(ms since epoch) but the migration gate compares it as seconds, so the effective wait is on the order of ~5×10¹² seconds. The "wait 5 minutes" guidance in the error message is misleading because the value isn't actually a 5-minute timeout — it's an overflowed/unconverted ms timestamp.My workaround was
DELETE FROM state_leases WHERE scope='startup-migrations';after the legacy JSON was moved aside.2. macOS launchd plist ships with
StandardErrorPath = /dev/null— users see exit-1 with no real error~/Library/LaunchAgents/ai.openclaw.gateway.plisthas:so the gateway's crash-loop only shows
launchctl listexit code 1 and a 15 MBgateway.logfull of repeatedDoctor warningsboxes. The real failure (Reason: OpenClaw startup migrations did not complete cleanly…) only appears ingateway.err.logonce I edited the plist to write stderr to a real file and reloaded. Every macOS-launchd user hitting this gate is going to spend 10+ minutes chasing the "Doctor warnings" loop before realizing the actual error is somewhere else entirely.Suggest: ship a plist template that writes both stdout and stderr to dated rotated files, and include a "first start failed — run
openclaw doctorthen check~/Library/Logs/openclaw/gateway.err.log" hint in the launchd KeepAlive output.3. simdjson ABI breaks
openclawCLI after the 7.1 upgrade — secondary failure that masks the real oneOnce I started looking for a way to run
openclaw doctorto inspect state, the CLI itself crashed before doing anything:Root cause:
simdjsonfrom a version shippinglibsimdjson.30.dylibto4.6.4which only shipslibsimdjson.33.dylib/opt/homebrew/bin/nodeis symlinked tonode@25(25.7.0), whose binary is linked againstlibsimdjson.30openclawCLI uses#!/usr/bin/env node→ picks the default node → dyld crash/opt/homebrew/opt/node@24/bin/nodedirectly — but the CLI wrapper doesn't honor that, and that's the same wrapper the user is told to run when the gateway is downThe OpenClaw
package.jsonenginesfield already restricts to>=22.22.3 <23 || >=24.15.0 <25 || >=25.9.0, but the CLI wrapper doesn't honor any of that — it just uses the firstnodeon PATH. The fix is either:openclawpackage's optionalbinscript (or add abinshim that resolves node at install time), orPATH="/opt/homebrew/opt/node@24/bin:$PATH" openclaw …for the duration of the simdjson mismatch window.This is independently a Homebrew / simdjson ABI issue, but for OpenClaw users it has the nasty property of preventing
openclaw doctorfrom running at all, which is the very command the startup-migration error tells you to run.Workaround (full path, for the issue body / FAQ)
Confirmed working on macOS 26.5, OpenClaw 2026.7.1 (2d2ddc4), upgrading from 2026.6.5, conflicting plugins were
brave, email, feishu. Different set from the OP and from @darealgege, in case that helps the pattern. FTR: this is a long-lived install too — the state dir has been around since 2025 and has been through many OpenClaw upgrades.For the lease specifically: @darealgege's hypothesis is dual-Node racing, which fits a Linux/multi-version install but not mine (only one Node is involved here — the 5-min wait just never elapses because the timestamp is unit-mismatched). If the gate is supposed to bound how long the lease is held, the bound itself appears to be broken in the ms-vs-seconds path.
clawsweeper commentedon Jul 14, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 14, 2026, 9:22 AM ET / 13:22 UTC.
Summary
Keep open for a narrow maintainer verification pass: merged pull request #107002 appears to address the central SQLite-authoritative migration dead end on current main, but the exact three-source state reported here has not been replayed, the fix is not in v2026.7.1, and the lease/service-restart observations remain separate concrete claims that should not be silently discarded.
Reproducibility: yes. at source and shipped-release evidence level: multiple users report the same v2026.7.1 warning-to-readiness-failure path, and the merged convergence work confirms that these legacy-state warnings controlled startup. A current-main exact-state replay is still missing.
Next step
Do not queue another fix PR yet: a broad candidate fix is already merged, and the next action is maintainer-owned exact-state verification plus a decision on whether surviving secondary symptoms need separate canonical issues.
Maintainer decision needed
Review details
Best possible solution:
Replay a copied v2026.7.1 state containing conflicting plugin-install, update-check, and config-health sources against current main, confirm Doctor converges and a second gateway start is clean, then close this issue while splitting any independently reproducible lease-expiry or service-restart defects into narrow canonical reports.
Do we have a high-confidence way to reproduce the issue?
Yes at source and shipped-release evidence level: multiple users report the same v2026.7.1 warning-to-readiness-failure path, and the merged convergence work confirms that these legacy-state warnings controlled startup. A current-main exact-state replay is still missing.
Is this the best way to solve the issue?
Yes in direction: one SQLite-authoritative convergence policy shared by Doctor and startup is safer than file-specific manual workarounds or new force flags. The remaining step is exact upgrade proof and separate handling of any lease or service-supervisor defect that survives it.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against a9316bc65ff9.
Label changes
Label changes:
clawsweeper:fix-shape-clear: Current issue advisory state selects this label.clawsweeper:needs-product-decision: Current issue advisory state no longer selects this label.Label justifications:
P0: The reported stable upgrade leaves the gateway unusable under service supervision and requires manual service, file, and possibly database intervention to recover.impact:crash-loop: Gateway startup repeatedly exits because migration warnings fail the readiness gate while launchd or systemd restarts the process.impact:ux-release-blocker: Affected upgrading users have no effective in-product recovery path; the advertised Doctor action does not resolve v2026.7.1 and recovery requires terminal commands and internal state knowledge.Evidence reviewed
Acceptance criteria:
What I checked:
src/infra/state-migrations.doctor.ts:803, 4da0eb19c570)src/infra/state-migrations.plugin-state.ts:235, 4da0eb19c570)src/commands/doctor-state-migrations.test.ts:397, 4da0eb19c570)CHANGELOG.md, 2d2ddc43d0dc)VISION.md:250, a9316bc65ff9)Likely related people:
src/infra/state-migrations.doctor.ts,src/infra/state-migrations.plugin-state.ts,src/infra/state-migrations.update-check.ts)src/infra/state-migrations.doctor.ts,src/infra/state-migrations.debug-proxy.ts,src/commands/doctor-state-migrations.test.ts)src/infra/state-migrations.doctor.ts,src/commands/doctor-state-migrations.test.ts,src/plugins/doctor-state-migration-fs.ts)src/commands/doctor-config-preflight.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.pfrederiksen commentedon Jul 14, 2026
Additional data point: 2026.7.1 migration gate remains fatal after plugin-state workaround; hit Memory Core conflicts, then a state-dir migration false/stale blocker.
Environment
2d2ddc4)~/.config/systemd/user/openclaw-gateway.service/usr/bin/node /usr/lib/node_modules/openclaw/dist/index.js gateway --port 18789/root/.openclawSummary
The plugin/update-check/config-health workaround was not sufficient for this install. There appear to be at least two additional unresolved migration-gate cases:
State dir migration skipped: target already exists (/root/.openclaw)warning even though no~/.clawdbot/~/.moltbotlegacy dirs exist and grep found no related config/env references.Initial status
openclaw gateway status --deep --require-rpcshowed:text
Runtime: stopped (state activating, sub auto-restart, last exit 1, reason 1)
Read probe: failed
gateway closed (1006 abnormal closure (no close frame)): no close reason
Service is loaded but not running (likely exited immediately).
First blocker after applying the plugin/update-check workaround
After moving the known conflicting legacy files aside, the gateway still crash-looped. Journal showed:
text
Reason: OpenClaw startup migrations did not complete cleanly; refusing to report the gateway ready.
State dir migration skipped: target already exists (/root/.openclaw). Remove or merge manually.
Skipped Memory Core legacy memory index import for agent researcher because legacy rows could not be imported: Error: legacy memory chunks rows conflict with canonical memory index rows
Skipped Memory Core legacy memory index import for agent email-agent because legacy rows could not be imported: Error: legacy memory chunks rows conflict with canonical memory index rows
...
This repeated for many agents.
Memory Core workaround attempted
Found per-agent legacy SQLite files:
text
/root/.openclaw/agents//agent/openclaw-agent.sqlite
/root/.openclaw/agents//agent/openclaw-agent.sqlite-wal
/root/.openclaw/agents//agent/openclaw-agent.sqlite-shm
Archived those per-agent
openclaw-agent.sqlite*files, leaving/root/.openclaw/state/openclaw.sqliteuntouched.After that, the Memory Core conflict disappeared.
Remaining fatal blocker
Gateway still refuses to start with only:
text
Reason: OpenClaw startup migrations did not complete cleanly; refusing to report the gateway ready.
State dir migration skipped: target already exists (/root/.openclaw). Remove or merge manually.
Run "openclaw doctor --fix" against the mounted state/config, then restart the container.
openclaw doctor --fixdid not clear this.Checked for legacy dirs/config/env
No legacy dirs found:
bash
ls -ld ~/.clawdbot ~/.moltbot ~/.openclaw 2>/dev/null
Output:
text
drwx------ 64 root root 20480 Jul 14 15:01 /root/.openclaw
No relevant config/env references found:
bash
grep -RInE "clawdbot|moltbot|CLAWD|MOLT|OPENCLAW_HOME|OPENCLAW_STATE|OPENCLAW_DIR|state dir"
~/.openclaw/openclaw.json
~/.openclaw/gateway.systemd.env
~/.config/systemd/user/openclaw-gateway.service
~/.config/systemd/user/openclaw-gateway.service.d 2>/dev/null
Output: no matches.
Runtime env only showed:
text
OPENCLAW_ALLOW_OLDER_BINARY_DESTRUCTIVE_ACTIONS=1
Current state
Downgrading to Beta6 got me moving.
pfrederiksen commentedon Jul 14, 2026
Follow-up on this same Linux/systemd install: it is now running successfully on OpenClaw 2026.7.1.
Recovery sequence after my earlier comment:
gateway ready, and the previousState dir migration skipped: target already existsfatal error no longer appears.Important caveat: I cannot attribute the migration recovery to the Node upgrade. The Node change removed a separate runtime-version blocker, while the intervening Beta6 downgrade/re-upgrade and prior archival of conflicting per-agent SQLite files mean this sequence does not isolate which step cleared the remaining state-dir migration gate. Still, this confirms the same long-lived state directory can subsequently boot 2026.7.1 without deleting
/root/.openclaw.maxatv commentedon Jul 14, 2026
Additional data point: amazon-bedrock plugin-install-index conflict on Amazon Linux 2023 / systemd — same fatal gate, same non-repairing doctor
Adding another concrete repro to the pile. Same core failure mode as OP; different plugin (
amazon-bedrock) and Linux distro.Environment
t3a.small~/.config/systemd/user/openclaw-gateway.service)v22.22.2under nvm (pre-upgrade); confirmed 7.1'senginesalso enforced>=22.22.3, which surfaced before the migration gate (see below)~/.openclaw/plugins/installs.jsonpresent, carries anamazon-bedrockmetadata row that has been emitting thestate-migrationswarning as benign since the 6.1 upgrade in early June — never blocking until 7.1.Sequence
openclaw update --tag 2026.7.1 --yes. npm global swap succeeded (19.7sglobal update +2.07sinstall swap). Doctor then refused with the Node minimum error; the automatic rollback did not roll back the on-disk npm package, soopenclaw --versionunder Node 22.22.2 became unrunnable.nvm install 22.22.3 && nvm alias default 22.22.3 && npm install -g openclaw@2026.7.1 && openclaw gateway install --force. Gateway started briefly, then began systemd-restart-looping with:openclaw doctor --fixran twice. On the first pass it did useful work: migrated Memory Core legacy memory index → per-agent SQLite (108 sources, 1029 chunks, 939 cache rows), archived a legacyconfig-health.json. Reported success. Both runs left the amazon-bedrock plugin-install-index conflict identical. Warning re-emitted verbatim on next startup.openclaw plugins update amazon-bedrock(advanced to a 7.1-compatible plugin version). Fatal warning unchanged — the conflict is on the install-index metadata rows, not the plugin version.openclaw gateway startbypassing systemd. Hit the state-migrations lease lock (retry after 2026-07-14T...Z) from the earlier failed restart cascade, and even after the lease expired the amazon-bedrock warning re-triggered the fatal gate.[ready]on 6.11 within ~90s of instance start, and a real end-to-end Telegram round-trip completed 47s later confirming the rollback was clean.Two secondary findings from this repro
a. Node minimum bump (22.22.3) is not release-note-flagged as breaking. It's real and enforced by
engines, but only visible AFTER npm has already swapped the global install to 7.1. On systemd-managed installs the automatic rollback re-invokes 7.1's binary against the old Node and cannot even reach--version. Recommend either (i) a pre-flightengines.nodeprobe inopenclaw updatethat refuses the swap if the active Node version is below the target's minimum, or (ii) at minimum, flagnode: >=22.22.3under "Breaking" in the release notes — a patch-bump Node minimum silently arriving in a.1release is a foot-gun. Matches @pfrederiksen's Node 22.22.2 → 24.18.0 note above (his Node change was mandatory before he could re-attempt 7.1 at all).b. Long-tail benign warnings promoted to fatal on major-era jumps. The amazon-bedrock plugin-install-index row that killed this upgrade has been sitting untouched in
installs.jsonsince the 6.1 upgrade six weeks ago, emitting the same warning on every doctor run without ever affecting agent function. Its promotion from "leave it alone, note it" (6.x) to "fail-closed on startup" (7.1) with no automatic reconcile path is exactly the class of thing PR #107002 addresses (per its "converge legacy startup migrations" description). Confirming for a maintainer: PR #107002 landed onmainat2026-07-14T03:05:25Z, roughly 3 hours before 2026.7.1 was cut in the field for me, so this reproduction is on a release that pre-dates the convergence fix. It would be very useful to know whether the next 2026.7.x patch is expected to include #107002 — that would let long-lived installs with legacy plugin-install-index rows upgrade without hand-editing SQLite.Meta
Blast radius here was 1 agent + 1 downstream user (Telegram bot for family use); we could afford the EBS snapshot dance. A sibling instance on the same fleet running 6 agents is now under a hard 7.x upgrade freeze pending resolution — filing a separate follow-up if the amazon-bedrock repro on a multi-agent install turns out to differ.
Happy to provide full journalctl output, the
state_leases/installed_plugin_indexSQLite dumps from the retained failed root volume, or the pre-upgrade doctor--jsonif it would help triangulate.steipete commentedon Jul 15, 2026
Fixed on
mainby #107961 (ef110e9a0f42e5c99d56f0126e7e42c4284865aa).The repair now treats the shared SQLite install record as canonical when the same plugin ID conflicts, while preserving the shipped partial-ledger migration for plugin IDs found only in legacy JSON. The retired JSON is archived for recovery; archive failures remain blocking and retryable.
Proof: 141 focused migration tests passed on current main; packaged Doctor/Gateway proof preserved SQLite values, converged cleanly on the second run, and reached gateway readiness; hosted CI and Workflow Sanity passed. Thanks @Marvinthebored and the additional reporters for the upgrade evidence, and @Patrick-Erichsen for the fix.
The separate Memory Core and state-directory cases mentioned in follow-up comments have different migration owners and are not folded into this plugin-install fix. Please open a focused issue, or ask to reopen this one, only with a reproduction of the same
plugins/installs.jsonconflict on a release containing the landed commit.smelike commentedon Jul 15, 2026
the same problem.
o Doctor warnings -------------------------------------------------------------------------+
| |
| - Left plugin install index in place because shared SQLite state has conflicting plugin |
| install metadata for: openclaw-weixin, qqbot |
| |
+-------------------------------------------------------------------------------------------+
14:29:46 [state-migrations] Legacy state migration warnings:
|
o Doctor warnings -------------------------------------------------------------------------+
| |
| - Left plugin install index in place because shared SQLite state has conflicting plugin |
| install metadata for: openclaw-weixin, qqbot |
| |
+-------------------------------------------------------------------------------------------+
Updating OpenClaw...
Failed to stop managed gateway service before update: Error: schtasks disable failed: 错误: 拒绝访问。