openclaw - 💡(How to fix) Fix memory_search broken with "index scope changed" after --force rebuild — scopeHash mismatch persists

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

Error Message

"error": "index scope changed" 3. Run memory_search — returns scope error 5. Run memory_search again — same error

Root Cause

Root Cause Evidence

Fix Action

Fix / Workaround

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.sqlite file and building from zero
  • Patching the hash directly in SQLite

Workarounds Attempted (none worked)

  • Multiple --force rebuilds
  • 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.

Code Example

"error": "index scope changed"
"warning": "memory index was built with a different embedding provider/model/settings"

---

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 — always
RAW_BUFFERClick to expand / collapse

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

  1. Configure memorySearch with provider: ollama, model: nomic-embed-text
  2. Index some memory files (in our case 144 files across MEMORY.md + dream logs)
  3. Run memory_search — returns scope error
  4. Run openclaw memory index --force — reports "Memory index updated"
  5. Run memory_search again — 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.sqlite file 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 — always

openclaw 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 --force rebuilds
  • 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING