Repository navigation
Description
Fatal gateway crash-loop on 2026.7.1: legacy memory-index sidecar meta/chunks conflicts are treated as fatal, while files conflicts auto-resolve
Summary
Upgrading from 2026.6.11 → 2026.7.1, the gateway crash-loops on startup, refusing to report ready, when an agent has a stale legacy Memory Core sidecar (~/.openclaw/memory/<agentId>.sqlite) whose meta (or chunks/embedding_cache) rows don't exactly match the already-canonical memory_index_* rows in the per-agent DB.
The same migration auto-resolves the equivalent conflict for the files table ("keeping canonical per-agent SQLite rows"), so the fatal-vs-recoverable behavior is inconsistent depending only on which table drifted.
Environment
- OpenClaw 2026.7.1 (regression from 2026.6.11, which logged this as a non-fatal warning and started normally)
- Node 22.23.1, Linux
- Long-lived install with a large per-agent memory index (canonical index ~32k chunks; stale sidecar ~200 chunks from months earlier)
Actual behavior
[state-migrations] Legacy state migration warnings:
- Skipped Memory Core legacy memory index import for agent <id> because legacy rows
could not be imported: Error: legacy memory meta rows conflict with canonical memory index rows
[openclaw] Reason: OpenClaw startup migrations did not complete cleanly; refusing to report the gateway ready.
Run "openclaw doctor --fix" against the mounted state/config, then restart the container.
openclaw-gateway.service: Main process exited, code=exited, status=1/FAILURE (repeats → auto-restart loop)
openclaw doctor --fix does not resolve it — it only repairs the unrelated recall store (rewrote recall store (-N invalid entries)), leaving the migration to fail again on the next start.
Root cause
importLegacyMemorySidecarIndex copies legacy rows with INSERT OR IGNORE, then asserts every legacy row now has an exact-value match in canonical:
// assertLegacyRowsCopied → engine-storage
if (Number(row?.missing ?? 0) > 0) throw new LegacyMemoryRowsConflictError(tableName);For meta, equality is over the full memory_index_meta_v1 JSON value — so any drift (e.g. an embedding-model descriptor that changed since the sidecar was written) yields missing > 0 and throws.
The caller (migrateLegacyMemorySidecarSource, extensions/memory-core/doctor-contract-api.js) only recovers for files:
} catch (err) {
if (err instanceof LegacyMemoryRowsConflictError && err.tableName === "files") {
params.changes.push(`Resolved ... by keeping canonical per-agent SQLite rows`);
return { archiveReady: true };
}
// meta / chunks / embedding_cache fall through →
params.warnings.push(`Skipped Memory Core legacy memory index import ... because legacy rows could not be imported: ${err}`);
return { archiveReady: false }; // ← propagates as a fatal startup-migration warning
}Because startup now treats any unresolved legacy-migration warning as fatal, a meta drift on a sidecar that is already fully superseded by canonical state bricks the gateway.
Expected behavior
When canonical per-agent rows already exist and are authoritative, a conflict in any legacy sidecar table should be recoverable the same way files is — keep canonical, archive the legacy sidecar, continue — rather than fatal. At minimum, the meta case (which is metadata, not indexed content) should not be able to block startup.
Suggested fix
- Extend the
tableName === "files"recovery branch to covermeta(and ideallychunks/embedding_cache): if canonical rows exist, prefer canonical, archive the sidecar, record a change instead of a fatal warning. - Alternatively, make "legacy sidecar fully superseded by canonical" a non-fatal condition in the startup-readiness gate.
- Consider having
doctor --fixactually resolve this (archive the superseded sidecar) since the error message directs users to it.
Workaround (worked for us)
Archive the stale sidecar using the same .migrated convention the successful path uses, then restart:
mv ~/.openclaw/memory/<agentId>.sqlite ~/.openclaw/memory/<agentId>.sqlite.migrated
# also move any orphaned -wal/-shm
systemctl --user restart openclaw-gateway(Verified the canonical memory_index_* tables in the agent DB were live and complete before archiving.)
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
kip-claw commentedon Jul 14, 2026
Confirming this on a different platform — Raspberry Pi 5 (ARM64, Debian bookworm), Node 24.15.0, upgrading
2026.6.11 → 2026.7.1via the global npm package.Identical failure and crash-loop (
Restart=always, ~2 min per failed boot):Root cause matches: a stale legacy sidecar
~/.openclaw/memory/main.sqlite(238 MB, months old) whosemetarows no longer match the canonicalmemory_index_*state.metadrift being fatal whilefilesauto-resolves is the exact inconsistency described here.Confirms it's not Node-22/x86-specific.
openclaw doctor --fixdid not resolve it here either. Rolled back to 2026.6.11 to restore service; will try the sidecar-archive workaround before re-attempting 7.1. Thanks for the detailed root-cause write-up.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:41 AM ET / 13:41 UTC.
Summary
Keep this issue open. Current main still treats divergent legacy
meta,chunks, andembedding_cacherows as blocking conflicts, while onlyfilesconflicts converge automatically; the open cache-specific fix does not cover the reportedmetaandchunkscases.Reproducibility: yes. at source level with high confidence: seed the canonical and legacy databases with the same row identity but divergent values, then run startup migration. Two independent 2026.7.1 installations also reproduced the resulting crash loop.
Root-cause cluster
Relationship:
canonicalCanonical: #107220
Summary: This issue is the broad Memory Core row-conflict report; narrower cache work and broader startup-gate reports overlap but do not replace its
metaandchunksdecision.Members:
partial_overlap: [Bug]: Memory Core embedding_cache conflict permanently blocks Gateway startup on 2026.7.1 #107133 - Covers only same-key divergentembedding_cacherows.partial_overlap: fix(memory-core): preserve canonical cache rows during legacy migration #107243 - Open candidate fix for compatible cache collisions only; it does not covermetaorchunks.superseded: fix(memory-core): preserve canonical embedding cache on migration #107276 - Closed unmerged cache-only proposal replaced by the currently open cache-specific candidate.partial_overlap: 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 #107227 - Tracks the broader fatal startup-migration gate and ineffective repair UX across several state sources.adjacent_distinct: [Bug]: Managed npm plugin repair loops forever ("integrity unknown") and permanently blocks the startup migration gate (2026.7.1-beta.6) #106604 - Reports a separate managed-plugin repair failure that reaches the same fatal readiness gate.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
The source-level repair boundary is clear, but automation must wait for a maintainer to choose the persisted-data authority rule for divergent metadata and chunks; the open cache PR should be reviewed separately.
Maintainer decision needed
metaorchunksrows conflict with the canonical per-agent index, what proof is sufficient to discard or archive the legacy copy without risking unique memory data?Review details
Best possible solution:
Adopt a table-specific migration policy: keep compatible canonical cache rows and canonical derived metadata, but archive conflicting chunk state only after proving it is fully represented or safely superseded; otherwise provide an explicit Doctor recovery flow that does not require manual SQLite or file operations.
Do we have a high-confidence way to reproduce the issue?
Yes, at source level with high confidence: seed the canonical and legacy databases with the same row identity but divergent values, then run startup migration. Two independent 2026.7.1 installations also reproduced the resulting crash loop.
Is this the best way to solve the issue?
No, the suggested blanket extension of the
filesbranch is not yet the safest fix because conflicting chunks may contain unique state. A table-specific canonical-authority rule plus a non-technical Doctor recovery path is safer.AGENTS.md: unclear because the file could not be read completely.
Remaining risk / open question:
chunkscould archive legacy content that is genuinely distinct or newer rather than safely superseded.metaconflict and the broaderchunkspolicy unresolved.Codex review notes: model internal, reasoning high; reviewed against 0b7811629960.
Label changes
Label justifications:
P0: A shipped upgrade can leave the core Gateway permanently unable to report ready and repeatedly restarting.impact:crash-loop: The unresolved migration warning causes the Gateway process to exit on every service restart.impact:ux-release-blocker: Affected users have no in-product recovery path and must inspect databases and manually archive state files.Evidence reviewed
What I checked:
INSERT OR IGNORE, verifies exact legacy-row equality, and only recoversLegacyMemoryRowsConflictErrorautomatically for thefilestable; other table conflicts become startup-blocking warnings. (extensions/memory-core/doctor-contract-api.ts, 0b7811629960)metaconflict, repeated Gateway exits, and an ineffectiveopenclaw doctor --fixpath. (2d2ddc43d0dc)extensions/memory-core/doctor-contract-api.ts, 414c250af90d)extensions/memory-core/doctor-contract-api.ts, 4da0eb19c570)embedding_cachecollisions and intentionally retains failure for dimensionally incompatible rows; it does not resolvemetaorchunksconflicts. (github.com) (extensions/memory-core/doctor-contract-api.ts:512, d851aa3)2d2ddc43d0dcf71f31283d780f9fe9ff4cc04fe4; no later shipped release is identified in the supplied repository state. (extensions/memory-core/doctor-contract-api.ts, 2d2ddc43d0dc)Likely related people:
extensions/memory-core/doctor-contract-api.ts,extensions/memory-core/doctor-contract-api.test.ts)extensions/memory-core/doctor-contract-api.ts,packages/memory-host-sdk/src/host/memory-schema.ts)extensions/memory-core/doctor-contract-api.ts,src/infra/state-migrations.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.kip-claw commentedon Jul 14, 2026
Follow-up from the Raspberry Pi / ARM64 report above: the sidecar-archive workaround did clear this specific conflict, but on this install it only revealed that the 2026.7.1 startup-migration gate is fatal for more than one reason.
What I did (canonical index verified authoritative first — 2,004 chunks / 286 sources, newer than the stale sidecar's 1,353):
The
legacy memory meta rows conflict with canonical memory index rowserror was gone — so the archive workaround works for the memory piece. ✅But the gateway still refused to start, now on a different fatal condition:
So clearing the memory-index gate just exposed a managed-plugin gate — same fatal "refusing to report ready" behavior. This looks like #106604 / #107227 (managed-plugin repair blocking the startup gate). One extra wrinkle worth flagging: when the network was briefly down, that plugin
npm installhung with no timeout rather than failing, so the gateway sat silently mid-boot (never ready, never crashed) until the network returned — a silent-hang failure mode in addition to the crash-loop.Net for anyone hitting this: the sidecar archive alone isn't sufficient to reach a healthy 2026.7.1 boot if you also have a managed plugin (e.g.
codex) that can't reinstall cleanly — each fatal gate has to be cleared in turn. Rolled back to 2026.6.11 again (healthy). Happy to provide more logs if useful.kip-claw commentedon Jul 14, 2026
Update from the Raspberry Pi / ARM64 install — after clearing the memory-index gate (this issue) I hit two more fatal startup-migration gates in sequence, so flagging them here since they're the same "any unresolved migration → refuse ready → crash-loop" pattern (see also #107227 / #106604).
Gate 2 — codex managed-plugin download (transient/network). With the sidecar archived, 7.1 next refused to start on
Failed to install missing configured plugin "codex"/Install dir is missing. Root cause was a partial download:@openclaw/codex@2026.7.1depends on@openai/codex, which pulls the platform binary@openai/codex@0.144.3-linux-arm64(~308 MB unpacked); a network blip left it half-installed (nodist/). Not a build issue — the published tarball ships a prebuiltdist/with no build scripts. Workaround that cleared it: pre-seed the npm cache with those tarballs (npm cache add @openclaw/codex@2026.7.1 @openai/codex@0.144.3 @openai/codex@0.144.3-linux-arm64 …) before starting, so the boot-time install is a cache hit instead of a live 308 MB download. That worked — the plugin installed cleanly (dist/present).Gate 3 — codex binding-sidecar migration (looks like a genuine packaging bug). Having cleared gates 1 and 2, 7.1 got further but then failed fatally on a different migration, processing legacy codex session state (
~/.openclaw/agents/main/sessions/*.jsonl.codex-app-server.json):The managed
@openclaw/codexplugin, running its migration from its install dir under~/.openclaw/npm/projects/…, can't resolve the globalopenclawcore package — anERR_MODULE_NOT_FOUNDduring migration. Unlike gates 1–2 there's no data/network workaround; it looks like a module-resolution/packaging bug in the plugin. Same fatal gate makes it bricking.Net: three independent fatal startup-migration gates on 6.11 → 7.1 for this install, each surfacing only after the previous is cleared. Rolled back to 2026.6.11 each time (healthy). Happy to grab more logs / a stack trace with
OPENCLAW_DEBUG=1if that helps triage gate 3.kip-claw commentedon Jul 14, 2026
Update: reached 2026.7.1 successfully on the Raspberry Pi / ARM64 install by clearing all three fatal startup-migration gates in sequence. Posting the full recipe in case it helps others stuck on the same cascade. (These are workarounds — the underlying "any unresolved migration → refuse ready → crash-loop" behavior is still the real bug, per #107227.)
All steps with the gateway stopped, and each is reversible (archive, don't delete):
Gate 1 — legacy memory sidecar
metaconflict (this issue):Gate 2 — codex managed-plugin install (
Install dir is missing/ half-installed): pre-seed the npm cache so the ~308 MB@openai/codex@…-linux-arm64binary doesn't have to download live during boot (a network blip mid-boot is what left it incomplete):Gate 3 — codex binding-sidecar migration (
ERR_MODULE_NOT_FOUND: Cannot find package 'openclaw'): the migration processes legacy*.codex-app-server.jsonsession sidecars, and the managed plugin can't resolve the globalopenclawcore from its install dir. Two-part workaround:Then upgrade + start:
Result: gateway reaches
ready, 13 plugins load (incl.codex), Telegram connects. First boot ran migrations for ~3–4 min; subsequent boots are fast (migrations are no-ops once the legacy state is archived). Verified durable across a full OS reboot — the service auto-starts clean, the symlink survives, and no gate re-triggers (new 7.1 sessions use native state, not the legacycodex-app-server.jsonformat).Environment: Raspberry Pi 5 (ARM64, Debian bookworm), Node 24.15.0, global npm install.
zzwtop1 commentedon Jul 15, 2026
me,too
OpenClaw version: from 6.11 to 7.1
[openclaw] Could not start the CLI.
Reason: OpenClaw startup migrations did not complete cleanly; refusing to report the gateway ready.
methylester commentedon Jul 15, 2026
Confirming on a third platform — macOS (Apple Silicon, Darwin 25.5.0), Node 26.5.0, launchd-managed gateway, upgrade
2026.6.11 → 2026.7.1via the global npm package. Identical crash-loop, andopenclaw doctor --fixdid not resolve it (it restarted the LaunchAgent and repaired unrelated recall-store entries; the migration failed again on the next boot).One data point that may help the pending product decision on auto-resolving
metaconflicts: on this install themetadrift has a precise and probably common cause — the embedding model changed between index generations. The stale sidecar (~/.openclaw/memory/main.sqlite, last written ~3 weeks before the upgrade) was built withnomic-embed-text/vectorDims: 768; the canonical per-agent index (agents/main/agent/openclaw-agent.sqlite) was rebuilt later withbge-m3/vectorDims: 1024and is strictly newer and larger (3690 vs 2737 chunks, 351 vs 250 sources). The twomemory_index_meta_v1JSON values can never converge, and the legacy vectors are dimensionally incompatible with the canonicalchunks_vectable — so for this class of drift the import isn't merely conflicting, it is impossible by construction. Keeping canonical rows (as thefilesbranch already does) seems strictly correct here: the index is derived data, and normal sync rebuilds anything missing from source files.Archive workaround confirmed working on macOS as well (canonical index verified authoritative first):
Gateway then boots clean;
openclaw memory statusshows the canonical index healthy (FTS ready, 1024-dim vectors), and a follow-upopenclaw memory indexsettles the dirty flag.macOS-specific aggravator for anyone else debugging this: the generated LaunchAgent hardcodes
StandardErrorPath=/dev/null(#90711), so none of the fatal migration output ever reachesgateway.log— the crash-loop is completely silent (launchctl listshows exit status 1 and nothing else). The failure reason is only visible when running the service command in the foreground.stephentnelson commentedon Jul 15, 2026
I independently observed the same startup-blocking migration behavior on Ubuntu/AWS Lightsail, with the conflict reported for legacy
chunksrows rather thanmetaorembedding_cache.Environment:
e085fa1)2d2ddc4)/home/ubuntu/.npm-global/lib/node_modules/openclawObserved startup error:
Observed behavior:
openclaw doctor --fixrepeated the conflict and did not clear the legacy-state finding.This was observed on one host state and has not been independently reproduced on a second clone.
The
chunksvariant appears consistent with the same fatal-vs-canonical-wins behavior described in this issue.galiniliev commentedon Jul 16, 2026
Confirming this on a fresh 2026.7.1 upgrade — same root cause, same workaround. Adding an independent repro with anonymized proofs and platform details.
Platform
2026.7.1 (2d2ddc4)v24.15.0Linux 6.17.0-40-generic x86_64(Ubuntu 24.04.4 LTS).../lib/node_modules/openclaw/openclaw.mjs)systemd 255(user serviceopenclaw-gateway.service)Symptom: fatal crash-loop, systemd gives up
Underneath the lease error, the real blocker is the memory-index migration:
Two chained failures (worth noting)
The fatal
metaconflict also strands the startup-migration lease. A gateway acquired thestartup-migrationslease, then was stopped mid-migration before releasing it; every restart within the 5-minute TTL then failed withstartup migrations are already running ... retry after <expiry>, and after 5 rapid failures systemd stopped retrying. So themeta-conflict bug can additionally manifest as a lease/start request repeated too quicklyloop until the TTL expires.Proof: the only
metadifference is theproviderKeyhashLegacy sidecar vs. already-canonical per-agent
memory_index_meta_v1— identical exceptproviderKey(hashes redacted):Everything (
model,scopeHash, chunk config,vectorDims) matches; onlyproviderKeydrifted — enough to makeassertLegacyRowsCopiedthrowLegacyMemoryRowsConflictError("meta").Proof: canonical index is already complete; the sidecar is stale
memory_index_chunks<agent-a><agent-b>So startup is bricked trying to import a handful of obsolete chunks into an index that already has 1000+ live chunks.
Workaround (confirms #107220)
Canonical
memory_index_*tables were verified live/complete before archiving the superseded sidecars:Result: clean start,
NRestarts=0, port18789→ HTTP200, andschema_metanow records thestartup-migrationscheckpoint for2026.7.1.+1 on the suggested fix: extend the
tableName === "files"recovery branch (migrateLegacyMemorySidecarSourceinextensions/memory-core/doctor-contract-api.ts) to also treatmeta(and ideallychunks/embedding_cache) conflicts as recoverable when canonical rows already exist — keep canonical, archive the sidecar, continue — instead of a fatal startup-migration warning.openclaw doctor --fixshould ideally perform that archival itself, since the error text points users there.amitch commentedon Jul 24, 2026
An fyi after reading workaround, so memory is not moved away.
Ran into above issue and gateway failed to start when upgrading from 2026.6.8 to 2026.7.1-2
This is on Linux VPS. Identified via Claude.
I see bug marked as fixed and I will install and check 2026.7.2 release
A note, the legacy side car sqlite are the only ones with rows for this openclaw
claw1:
/.openclaw# sqlite3 ./agents/main/agent/openclaw-agent.sqlite "SELECT count(*) FROM memory_index_meta;"/.openclaw# sqlite3 ./memory/main.sqlite "SELECT count() FROM meta;"0
claw1:
sqlite3 ./memory/main.sqlite "SELECT count() FROM chunks;"
sqlite3 ./memory/main.sqlite "SELECT count(*) FROM chunks_vec_chunks;"
1
4065
4