Repository navigation
Description
Description
After running openclaw memory index --force, the memory_search tool returns:
"error": "index scope changed"
"warning": "memory index was built with a different embedding provider/model/settings"
The scope hash stored in the SQLite meta table never matches any computation against the current files table, regardless of rebuild attempts.
Version
- OpenClaw: 2026.6.1 (2e08f0f)
- Provider: ollama / nomic-embed-text (768-dim vectors)
- Vector store: sqlite-vec (vec0.so)
- Platform: Linux (WSL2 Ubuntu 22.04)
To Reproduce
- Configure memorySearch with
provider: ollama,model: nomic-embed-text - Index some memory files (in our case 144 files across MEMORY.md + dream logs)
- Run
memory_search— returns scope error - Run
openclaw memory index --force— reports "Memory index updated" - Run
memory_searchagain — same error
Root Cause Evidence
The hash e861c1d291b583b9f4bf96233b72b9e6984cc92320671a0805e1063946e4b1a1 is written by the indexer into meta.memory_index_meta_v1.scopeHash and never changes across rebuilds — even after:
- Deleting the meta row entirely and rebuilding
- Deleting the entire
main.sqlitefile and building from zero - Patching the hash directly in SQLite
The computed hash from the actual files table always differs from the stored hash. The indexer and the gateway scope validator appear to be computing the hash differently — likely the indexer includes a field or ordering that the validator uses differently, or vice versa.
Core diagnostics we ran:
files = conn.execute(SELECT path, source, hash FROM files ORDER BY path).fetchall()
file_list = [{"path": p, "source": s, "hash": h} for p, s, h in files]
computed = hashlib.sha256(json.dumps(file_list, sort_keys=True).encode()).hexdigest()
# computed != stored scopeHash — alwaysopenclaw memory status --index reports everything as ready (144 files, 768-dim vectors, embeddings/vector store ready). 33MB SQLite.
Expected Behavior
After --force rebuild, the scope hash should be recomputed from the actual indexed files and memory_search should return results.
Workarounds Attempted (none worked)
- Multiple
--forcerebuilds - Deleting SQLite entirely and rebuilding from scratch
- Directly patching scopeHash in SQLite to match computed values
- Full gateway cold restart after rebuild
For now we are using a separate graph memory system (LadybugDB MCP) for structured retrieval as a workaround.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 9, 2026
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.
Close as duplicate/superseded: the current symptom is still real, but the remaining provider/runtime identity and scope validation work is already tracked by the open canonical issue, with the live-manager reload slice tracked separately.
Root-cause cluster
Relationship:
duplicateCanonical: #91902
Summary: This issue is a satellite of the open provider/runtime memory identity tracker; its newest v2026.6.10 reproduction and the canonical issue both cover CLI-healthy indexes being rejected by in-session
memory_searchthrough providerKey/scopeHash identity drift.Members:
canonical: [BUG] memory index --force CLI writes incompatible meta providerKey, breaks runtime memory_search #91902 - Open canonical tracker for CLImemory index --forcewriting metadata that runtimememory_searchrejects, including providerKey drift and scopeHash discrepancy.partial_overlap: bug(memory): gateway cannot self-heal a missing index identity when chunks are already indexed #91167 - Open canonical live-manager publication/reload issue covers missing identity and stale SQLite handle recovery, which overlaps the missing-metadata comments but not the providerKey/scopeHash tracker.partial_overlap: agentmemory__memory_search returns "index metadata is missing" persistently (memory-core manager state cache) #90414 - Open persistent runtime-tool missing-metadata report covers manager/cache drift and config drift, overlapping one symptom but not the focusedindex scope changedafter force-rebuild report.partial_overlap: [Bug]: Memory search completely broken — FTS-only hangs, embeddings hang, --force corrupts meta (Ollama/bge-m3, Linux, 2026.6.8) #94125 - Open umbrella memory outage report includes this scopeHash/force-rebuild failure among several other memory search failures.adjacent_distinct: [Bug]: openclaw memory status shows "Vector store: unknown" despite working vectors (sqlite-vec lazy init in CLI fast path) #92102 - Open vector status false-negative issue is mentioned in the discussion but concerns status display rather than runtime identity rejection.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Canonical path: Keep the remaining provider/runtime memory identity work consolidated on #91902, with live-manager publication/reload details preserved on #91167.
So I’m closing this here and keeping the remaining discussion on #91902 and #91167.
Review details
Best possible solution:
Keep the remaining provider/runtime memory identity work consolidated on #91902, with live-manager publication/reload details preserved on #91167.
Do we have a high-confidence way to reproduce the issue?
Yes at source level and from latest-release field evidence; I did not run a live current-main Ollama/Voyage setup. Current source still pauses search on invalid index identity, and the latest comment reports v2026.6.10 reproducing after CLI status/search succeed.
Is this the best way to solve the issue?
Yes for triage: closing this satellite is the best cleanup path because the remaining provider/runtime identity work is already tracked by the open canonical issue. The implementation fix still needs a maintainer-approved identity policy that keeps CLI rebuild, runtime provider resolution, scopeHash, and live manager state coherent.
Security review:
Security review: This is a non-PR bug triage item with no patch or security-sensitive report under review.
AGENTS.md: found and applied where relevant.
What I checked:
index metadata is missingfor missing meta andindex scope changedwhen persisted scopeHash differs from configured scope. (extensions/memory-core/src/memory/manager-reindex-state.ts:160, 938855082ade)MemoryIndexManager.search()refreshes index identity and returns no results when the identity state is not valid, which is the source-level fail-closed behavior behind the unavailable tool result. (extensions/memory-core/src/memory/manager.ts:667, 938855082ade)extensions/memory-core/src/memory/manager-reindex-state.ts:160, aa69b12d0086)memory index --forcewriting incompatible runtime metadata, providerKey drift, non-default provider reproductions, and a confirmed scopeHash discrepancy.memory_searchfails withindex scope changed, and explicitly says it probably overlaps the canonical providerKey tracker.Likely related people:
extensions/memory-core/src/memory/manager-reindex-state.ts,extensions/memory-core/src/memory/manager-sync-ops.ts,extensions/memory-core/src/memory/manager.ts)extensions/memory-core/src/memory/manager-sync-ops.ts,extensions/memory-core/src/memory/manager.ts,extensions/memory-core/src/memory/manager-reindex-state.ts)extensions/memory-core/src/memory/manager-reindex-state.ts,extensions/memory-core/src/memory/embeddings.ts,extensions/memory-core/src/memory/embeddings.test.ts)Codex review notes: model internal, reasoning high; reviewed against 938855082ade.
mtoko commentedon Jun 12, 2026
Another instance: Voyage provider, per-agent SQLite, mixed embedding model versions
Environment
voyage / voyage-3Context
We have three agents configured:
main,analyst, andclient. Only theanalystagent was affected.mainandclientboth had working memory search throughout.What we saw
Every time the gateway restarted,
memory_searchin theanalystsession returned:{ "error": "index metadata is missing", "warning": "memory index was built with a different embedding provider/model/settings" }Running
openclaw memory index --force(or--agent analyst) would temporarily fix it, but the next gateway restart broke it again.openclaw memory status --indexalways reported the analyst as healthy after a force rebuild. We also wasted time chasingVector store: unknownas the root cause — see #92102 for the false-negative CLI display issue.Root cause we found
Two layered problems:
1. Mixed embedding model versions in
analyst.sqliteInspecting the file with
stringsrevealed theembedding_cachetable contained entries for bothvoyage-4-large(an old model no longer in config) andvoyage-3(the current model). Thememory_index_meta_v1row correctly namedvoyage-3, but the cached vectors were contaminated.The analyst SQLite had accumulated these
voyage-4-largeentries from a previous configuration. The gateway appears to detect this inconsistency on startup and clears/ignores the metadata row, leaving the index in a broken state.2. No explicit
workspacefor theanalystagentOur
analystagent had no explicitworkspacefield in config. The CLI (openclaw memory index) auto-resolved the workspace to/home/darryl/clawd/analyst(from the AGENTS.md location), but we believe the gateway may have been resolving it differently at startup, producing a differentscopeHash.Why only
analystand notmainorclient?mainwas built a long time ago with the oldvoyage-4-largeentries only — no mixed models, consistent metadataclienthas an explicitworkspacein configanalysthad neither: no explicit workspace, and anembedding_cachecontaminated with a superseded modelWorkaround that resolved the issue
After cleaning the analyst SQLite and adding the explicit workspace, the scopeHash mismatch continued (the gateway still cleared metadata on startup). The fix that finally unblocked us was disabling the vector store for the analyst agent:
With
vector.enabled: false, the analyst falls back to FTS-only mode. Memory search now works correctly and survives gateway restarts. The trade-off is semantic vector ranking is disabled for this agent only.Suggested investigation
The gateway appears to be silently clearing
memory_index_meta_v1from a per-agent SQLite on startup when it encounters the vec store state or embedding cache inconsistencies — without logging anything to journalctl. Operators have no way to know this is happening.Two asks:
strings-inspecting the SQLitemtoko commentedon Jun 12, 2026
Update: original workaround was not stable — additional findings
Following up on my earlier comment. The
memorySearch.store.vector.enabled: falseworkaround I described was not stable. Here's a more complete picture after further investigation.What we now know about the recurring trigger
The metadata invalidation is not just happening at gateway startup. It also happens during the session, after the first
memory_searchcall. The sequence we observed repeatedly:memory_searchcall succeeds and returns resultsmemory_searchcall returns"index metadata is missing"againWe believe the first successful search triggers a background sync operation which then re-validates the scopeHash. The re-validation fails, the metadata gets cleared, and all further searches in the session fail.
Key diagnostic:
SIGUSR1hot-reload (thegateway restarttool) does not reinitialise the memory module. The module's failed/broken state is pinned from when it was first initialised. Only a full process restart (systemctl --user restart openclaw-gateway.service) clears it — but the problem then recurs in the new session.Further workaround attempts
We tried pointing the analyst agent at the working
main.sqlitedirectly:This worked transiently (memory search returned results with vector scores immediately after restart), but broke again within the same session. The
sync: falsesettings did not prevent the re-invalidation.What we think is happening
The gateway appears to have a background validation loop (separate from the configured
synctriggers) that periodically re-checks the scopeHash against the live database state. When it detects a mismatch, it clears the metadata and marks the module as unavailable — silently, with no log output to journalctl.This is distinct from the startup mismatch described in the original issue. The problem survives
syncbeing disabled.Minimal reproduction
~/clawd)workspacein config (auto-resolved by CLI to~/clawd/analyst, but gateway uses~/clawddefault)voyage / voyage-3memory_search→ success → run secondmemory_search→"index metadata is missing"What would fix this
At the OpenClaw level, two things would resolve this permanently:
The scopeHash validation should not clear the metadata mid-session. If it detects a mismatch, it should log a warning and continue with the stale index rather than silently breaking all searches.
The background validator should be controlled by the same
sync.*knobs as the foreground sync. Ifsync.onSearch: falseandsync.watch: false, no validation loop should run.We're on OpenClaw 2026.6.1 (2e08f0f), x86_64, Ubuntu 24.04, Node 22.22.0, voyage/voyage-3.
mtoko commentedon Jun 12, 2026
Update 2: still broken in 2026.6.5, exact reproduction pattern confirmed
Upgraded to 2026.6.5 (5181e4f) today. Issue persists.
Exact reproduction pattern now confirmed
After a full gateway restart (
systemctl --user restart):memory_searchcall in the session succeeds (vectorScore present, results returned)memory_searchcall in the same session fails with"index metadata is missing"openclaw memory index --force --agent analystand retrying → fails immediately (no working call even)This confirms the background validator fires between calls 1 and 2, clears the metadata, and the module enters a permanently broken state for the rest of the session. No amount of CLI rebuilding recovers it without a full gateway restart — and the restart just resets the cycle.
What 2026.6.5 changed (memory-related)
From the release notes: "memory adapter status uses the resolved default model identity when checking plain status" (#61834). This did not affect our issue.
Current workaround config (not sufficient but documented for others)
{ "id": "analyst", "memorySearch": { "store": { "path": "/home/darryl/.openclaw/memory/main.sqlite" }, "sync": { "onSessionStart": false, "onSearch": false, "watch": false } } }sync: falsedoes not prevent the background validation loop. The validator appears to run independently of sync settings.Suggestion for maintainers
The background validator that invalidates metadata mid-session needs to be either:
The current silent mid-session invalidation makes the memory module unusable in multi-query workflows.
wangwllu commentedon Jun 29, 2026
Additional reproduction on 2026.6.10
I can still reproduce the mismatch on a current local install.
Environment:
2026.6.10 (aa69b12)Darwin 24.6.0 arm64builtinollama / nomic-embed-text768After a forced rebuild, the CLI side looks healthy:
Redacted status highlights:
files=281,chunks=1624dirty=falseextraPaths=[]provider=ollama,model=nomic-embed-text,requestedProvider=ollamafts.available=truevector.available=true,semanticAvailable=true,storeAvailable=truecustom.indexIdentity.status=validembeddingProbe.ok=trueCLI search also returns results for the same memory corpus:
But the first-class in-session
memory_searchtool still fails immediately with:{ "results": [], "disabled": true, "unavailable": true, "error": "index scope changed", "warning": "Tell the user: memory search is paused because the memory index was built with a different embedding provider/model/settings.", "action": "Tell the user to run: openclaw memory status --index or openclaw memory index --force." }So the user-facing recovery instruction points to
memory status --index/memory index --force, but that path has already been run and now reports a valid index identity plus a successful embedding probe. This looks aligned with the existing provider/runtime identity or scope validation cluster, and probably overlaps the canonical providerKey tracker in #91902 rather than needing a separate issue.