Skip to content

2026.7.1 gateway crash-loop: legacy memory sidecar meta/chunks conflicts are fatal while files conflicts auto-resolve #107220

Closed

Description

@liewjiajun

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 cover meta (and ideally chunks/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 --fix actually 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.)

Activity

  1. kip-claw commented on Jul 14, 2026

    @kip-claw
    Contributor

    Confirming this on a different platform — Raspberry Pi 5 (ARM64, Debian bookworm), Node 24.15.0, upgrading 2026.6.11 → 2026.7.1 via the global npm package.

    Identical failure and crash-loop (Restart=always, ~2 min per failed boot):

    [state-migrations] Skipped Memory Core legacy memory index import for agent main 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.
    openclaw.service: Main process exited, code=exited, status=1/FAILURE
    

    Root cause matches: a stale legacy sidecar ~/.openclaw/memory/main.sqlite (238 MB, months old) whose meta rows no longer match the canonical memory_index_* state. meta drift being fatal while files auto-resolves is the exact inconsistency described here.

    Confirms it's not Node-22/x86-specific. openclaw doctor --fix did 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.

  2. added
    P0Emergency: data loss, security bypass, crash loop, or unusable core runtime.
    impact:crash-loopCrash, hang, restart loop, or process-level availability failure.
    impact:ux-release-blockerA non-technical user is blocked without terminal, logs, config, or support.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    on Jul 14, 2026
  3. clawsweeper commented on Jul 14, 2026

    @clawsweeper
    Contributor

    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, and embedding_cache rows as blocking conflicts, while only files conflicts converge automatically; the open cache-specific fix does not cover the reported meta and chunks cases.

    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: canonical
    Canonical: #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 meta and chunks decision.

    Members:

    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

    • Question: When legacy Memory Core meta or chunks rows conflict with the canonical per-agent index, what proof is sufficient to discard or archive the legacy copy without risking unique memory data?
    • Rationale: The outage is clearly reproducible, but choosing canonical-wins for every table changes the persisted-data preservation contract; source inspection alone cannot determine whether divergent chunk content may be discarded.
    • Likely owner: vincentkoc — They merged and co-authored the original persisted-state migration and have the strongest visible ownership signal for the Memory Core upgrade contract.
    • Options:
      • Use table-specific convergence (recommended): Treat compatible cache and derived metadata as canonical-wins, while requiring positive supersession or merge proof before archiving divergent chunks.
      • Keep every conflict fail-closed: Preserve the current data-safety policy but add a guided Doctor repair that shows the conflict and lets the operator archive or reconcile it without manual file work.
      • Make canonical rows authoritative: Archive the entire legacy sidecar whenever the canonical index is non-empty, accepting that unique divergent legacy chunks may be discarded.
    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 files branch 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:

    • Blanket canonical-wins handling for chunks could archive legacy content that is genuinely distinct or newer rather than safely superseded.
    • Keeping all divergent rows fail-closed leaves affected upgrades in a permanent Gateway outage whose advertised Doctor recovery path cannot resolve the condition.
    • Landing only the cache-specific pull request would leave the independently reproduced meta conflict and the broader chunks policy 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:

    Likely related people:

    • mushuiyu886: Authored the original legacy Memory Core sidecar-to-agent SQLite migration and its conflict-preservation policy in the merged implementation. (github.com) (role: introduced behavior; confidence: high; commits: 414c250af90d; files: extensions/memory-core/doctor-contract-api.ts, extensions/memory-core/doctor-contract-api.test.ts)
    • vincentkoc: Merged and co-authored the original migration after extensive review, and is repeatedly connected to Memory Core storage and upgrade work. (github.com) (role: merger and adjacent owner; confidence: high; commits: 414c250af90d; files: extensions/memory-core/doctor-contract-api.ts, packages/memory-host-sdk/src/host/memory-schema.ts)
    • steipete: Authored and merged the subsequent cross-surface legacy migration convergence change that distinguishes safely superseded residue from real divergence. (github.com) (role: recent migration-policy contributor; confidence: high; commits: 4da0eb19c570; files: extensions/memory-core/doctor-contract-api.ts, src/infra/state-migrations.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  4. kip-claw commented on Jul 14, 2026

    @kip-claw
    Contributor

    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):

    systemctl stop openclaw
    mv ~/.openclaw/memory/main.sqlite ~/.openclaw/memory/main.sqlite.migrated-<ts>   # + moved orphaned .tmp-* aside
    # upgrade 2026.6.11 -> 2026.7.1, clear compile cache, start

    The legacy memory meta rows conflict with canonical memory index rows error was gone — so the archive workaround works for the memory piece. ✅

    But the gateway still refused to start, now on a different fatal condition:

    - Failed to install missing configured plugin "codex" from @openclaw/codex: npm install failed:  Run `openclaw update repair` to retry plugin...
    - Plugin "codex" failed post-core payload smoke check (missing-package-dir): Install dir is missing: /home/kip/.openclaw/npm/projects/openclaw-...
    [openclaw] Reason: OpenClaw startup migrations did not complete cleanly; refusing to report the gateway ready.
    openclaw.service: Main process exited, code=exited, status=1/FAILURE   (Restart=always → crash-loop)
    

    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 install hung 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.

  5. kip-claw commented on Jul 14, 2026

    @kip-claw
    Contributor

    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.1 depends 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 (no dist/). Not a build issue — the published tarball ships a prebuilt dist/ 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):

    - Left Codex binding sidecar in place because migration or archiving failed:
      Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'openclaw' imported from
      ~/.openclaw/npm/projects/openclaw-codex-<hash>/node_modules/@openclaw/codex/dist/config-<hash>.js
    [openclaw] Reason: OpenClaw startup migrations did not complete cleanly; refusing to report the gateway ready.
    openclaw.service: Main process exited, code=exited, status=1/FAILURE   (Restart=always → crash-loop)
    

    The managed @openclaw/codex plugin, running its migration from its install dir under ~/.openclaw/npm/projects/…, can't resolve the global openclaw core package — an ERR_MODULE_NOT_FOUND during 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=1 if that helps triage gate 3.

  6. kip-claw commented on Jul 14, 2026

    @kip-claw
    Contributor

    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 meta conflict (this issue):

    # verify canonical index is authoritative first (chunks >= sidecar's), then:
    mv ~/.openclaw/memory/main.sqlite ~/.openclaw/memory/main.sqlite.migrated

    Gate 2 — codex managed-plugin install (Install dir is missing / half-installed): pre-seed the npm cache so the ~308 MB @openai/codex@…-linux-arm64 binary doesn't have to download live during boot (a network blip mid-boot is what left it incomplete):

    npm cache add @openclaw/codex@2026.7.1 @openai/codex@0.144.3 @openai/codex@0.144.3-linux-arm64 typebox@1.3.3 ws@8.21.0 zod@4.4.3

    Gate 3 — codex binding-sidecar migration (ERR_MODULE_NOT_FOUND: Cannot find package 'openclaw'): the migration processes legacy *.codex-app-server.json session sidecars, and the managed plugin can't resolve the global openclaw core from its install dir. Two-part workaround:

    # a) archive the legacy binding sidecars so the migration has nothing to process
    mkdir -p ~/.openclaw/_codex-sidecars-archive
    mv ~/.openclaw/agents/*/sessions/*.codex-app-server.json ~/.openclaw/_codex-sidecars-archive/
    # b) make the core package resolvable from the plugin dir (belt-and-suspenders)
    ln -sfn /usr/lib/node_modules/openclaw ~/.openclaw/npm/projects/openclaw-codex-*/node_modules/openclaw

    Then upgrade + start:

    sudo npm install -g --allow-scripts=openclaw,@google/genai,protobufjs,tree-sitter-bash openclaw@2026.7.1
    sudo rm -rf /var/tmp/openclaw-compile-cache
    sudo systemctl start openclaw

    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 legacy codex-app-server.json format).

    Environment: Raspberry Pi 5 (ARM64, Debian bookworm), Node 24.15.0, global npm install.

  7. zzwtop1 commented on Jul 15, 2026

    @zzwtop1

    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.

    • Skipped Memory Core daily ingestion import for /root/.openclaw/workspace-* because SQLite rows already exist; left legacy source in place
    • Skipped Memory Core session ingestion import ... (similar for all workspaces)
    • Skipped Memory Core short-term recall import ... (similar)
    • Skipped Memory Core legacy memory index import for agent yunxia because legacy rows could not be imported: Error: legacy memory meta rows conflict with canonical memory index rows
  8. methylester commented on Jul 15, 2026

    @methylester

    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.1 via the global npm package. Identical crash-loop, and openclaw doctor --fix did 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 meta conflicts: on this install the meta drift 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 with nomic-embed-text / vectorDims: 768; the canonical per-agent index (agents/main/agent/openclaw-agent.sqlite) was rebuilt later with bge-m3 / vectorDims: 1024 and is strictly newer and larger (3690 vs 2737 chunks, 351 vs 250 sources). The two memory_index_meta_v1 JSON values can never converge, and the legacy vectors are dimensionally incompatible with the canonical chunks_vec table — so for this class of drift the import isn't merely conflicting, it is impossible by construction. Keeping canonical rows (as the files branch 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):

    launchctl bootout gui/$UID/ai.openclaw.gateway
    mv ~/.openclaw/memory/main.sqlite ~/.openclaw/memory/main.sqlite.migrated
    launchctl bootstrap gui/$UID ~/Library/LaunchAgents/ai.openclaw.gateway.plist

    Gateway then boots clean; openclaw memory status shows the canonical index healthy (FTS ready, 1024-dim vectors), and a follow-up openclaw memory index settles 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 reaches gateway.log — the crash-loop is completely silent (launchctl list shows exit status 1 and nothing else). The failure reason is only visible when running the service command in the foreground.

  9. stephentnelson commented on Jul 15, 2026

    @stephentnelson

    I independently observed the same startup-blocking migration behavior on Ubuntu/AWS Lightsail, with the conflict reported for legacy chunks rows rather than meta or embedding_cache.

    Environment:

    • Last known good: OpenClaw 2026.6.11 (e085fa1)
    • First known bad: OpenClaw 2026.7.1 (2d2ddc4)
    • Ubuntu 24.04.4 LTS (Noble Numbat), amd64
    • Linux kernel 6.17.0-1017-aws
    • Node.js 22.23.1
    • npm user-global install:
      /home/ubuntu/.npm-global/lib/node_modules/openclaw

    Observed startup error:

    Skipped Memory Core legacy memory index import for agent vault-librarian because legacy rows could not be imported: Error: legacy memory chunks rows conflict with canonical memory index rows
    
    OpenClaw startup migrations did not complete cleanly; refusing to report the gateway ready.
    

    Observed behavior:

    • Gateway repeatedly failed/restarted.
    • openclaw doctor --fix repeated the conflict and did not clear the legacy-state finding.
    • No manual SQLite query, edit, or repair was performed.
    • Recovery required restoring the pre-upgrade 2026.6.11 Lightsail snapshot to a replacement instance.
    • End-to-end Slack invocation succeeded after rollback/recovery.

    This was observed on one host state and has not been independently reproduced on a second clone.

    The chunks variant appears consistent with the same fatal-vs-canonical-wins behavior described in this issue.

  10. self-assigned this
    on Jul 16, 2026
  11. galiniliev commented on Jul 16, 2026

    @galiniliev
    Contributor

    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

    • OpenClaw: 2026.7.1 (2d2ddc4)
    • Node: v24.15.0
    • OS: Linux 6.17.0-40-generic x86_64 (Ubuntu 24.04.4 LTS)
    • Install: npm global via Homebrew (.../lib/node_modules/openclaw/openclaw.mjs)
    • Service manager: systemd 255 (user service openclaw-gateway.service)

    Symptom: fatal crash-loop, systemd gives up

    node[####]: [openclaw] The CLI command failed.
    node[####]: [openclaw] Reason: OpenClaw startup migrations are already running for this state directory; retry after ... or after 2026-07-16T05:45:05.394Z.
    systemd[...]: openclaw-gateway.service: Main process exited, code=exited, status=1/FAILURE
    systemd[...]: openclaw-gateway.service: Scheduled restart job, restart counter is at 4.
    systemd[...]: openclaw-gateway.service: Start request repeated too quickly.
    systemd[...]: Failed to start openclaw-gateway.service - OpenClaw Gateway (v2026.7.1).
    

    Underneath the lease error, the real blocker is the memory-index migration:

    [state-migrations] Legacy state migration warnings:
    - Skipped Memory Core legacy memory index import for agent <agent-a> because legacy rows
      could not be imported: Error: legacy memory meta rows conflict with canonical memory index rows
    - Skipped Memory Core legacy memory index import for agent <agent-b> 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.
    

    Two chained failures (worth noting)

    The fatal meta conflict also strands the startup-migration lease. A gateway acquired the startup-migrations lease, then was stopped mid-migration before releasing it; every restart within the 5-minute TTL then failed with startup migrations are already running ... retry after <expiry>, and after 5 rapid failures systemd stopped retrying. So the meta-conflict bug can additionally manifest as a lease/start request repeated too quickly loop until the TTL expires.

    Proof: the only meta difference is the providerKey hash

    Legacy sidecar vs. already-canonical per-agent memory_index_meta_v1 — identical except providerKey (hashes redacted):

    legacy    : {"model":"text-embedding-3-small","provider":"openai","providerKey":"<hashA>","sources":["memory"],"scopeHash":"<scope>","chunkTokens":400,"chunkOverlap":80,"ftsTokenizer":"unicode61","vectorDims":1536}
    canonical : {"model":"text-embedding-3-small","provider":"openai","providerKey":"<hashB>","sources":["memory"],"scopeHash":"<scope>","chunkTokens":400,"chunkOverlap":80,"ftsTokenizer":"unicode61","vectorDims":1536}
    

    Everything (model, scopeHash, chunk config, vectorDims) matches; only providerKey drifted — enough to make assertLegacyRowsCopied throw LegacyMemoryRowsConflictError("meta").

    Proof: canonical index is already complete; the sidecar is stale

    agent legacy sidecar chunks (age) canonical memory_index_chunks
    <agent-a> 2 (≈2 months old) 1100
    <agent-b> 13 (≈1 month old) 905

    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:

    mkdir -p ~/openclaw-legacy-memory-backup
    mv ~/.openclaw/memory/<agent-a>.sqlite ~/.openclaw/memory/<agent-b>.sqlite ~/openclaw-legacy-memory-backup/
    systemctl --user reset-failed openclaw-gateway.service
    openclaw gateway restart

    Result: clean start, NRestarts=0, port 18789 → HTTP 200, and schema_meta now records the startup-migrations checkpoint for 2026.7.1.

    +1 on the suggested fix: extend the tableName === "files" recovery branch (migrateLegacyMemorySidecarSource in extensions/memory-core/doctor-contract-api.ts) to also treat meta (and ideally chunks/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 --fix should ideally perform that archival itself, since the error text points users there.

  12. amitch commented on Jul 24, 2026

    @amitch

    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;"
    0
    claw1:
    /.openclaw# sqlite3 ./memory/main.sqlite "SELECT count() FROM meta;"
    sqlite3 ./memory/main.sqlite "SELECT count(
    ) FROM chunks;"
    sqlite3 ./memory/main.sqlite "SELECT count(*) FROM chunks_vec_chunks;"
    1
    4065
    4

  13. locked as resolved and limited conversation to collaborators on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0Emergency: data loss, security bypass, crash loop, or unusable core runtime.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:ux-release-blockerA non-technical user is blocked without terminal, logs, config, or support.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions