Repository navigation
Description
Bug: agentmemory__memory_search returns "index metadata is missing" persistently
Environment
- OpenClaw: 2026.6.1 (latest, confirmed via
npm view openclaw version) - Platform: Linux x64, Node v22.22.2
- Plugin: agentmemory 0.9.4 (extension) + @agentmemory/mcp 0.9.26 + @agentmemory/agentmemory 0.9.26
- Discovered: 2026-06-04
Summary
The runtime tool agentmemory__memory_search consistently returns the error "index metadata is missing" with the action hint "Tell the user to run: openclaw memory status --index or openclaw memory index --force" — even when the underlying infrastructure is healthy.
Reproduction
- Fresh install / any state where
~/.openclaw/memory/{agent}.sqlitehas emptymetatable on gateway startup - Run
openclaw memory index --forceto reindex all 12 agents (meta table populated, all 12 agents have 1 row with correctmodel: voyage-4-large, provider: voyage) - Run
openclaw memory search "anything" --agent cleofrom CLI → works, returns results or "no matches" - Call
memory_searchtool from agent runtime → returns "index metadata is missing" - Try
kill -USR1 <gateway_pid>→ tool still returns same error - Try
systemctl --user restart openclaw-gateway→ tool still returns same error after gateway comes back npm update -g openclaw(no version change, but 285 deps updated) → tool still broken
Expected
Tool should use the live DB state and return results once meta table is populated.
Actual
Tool returns {"error":"index metadata is missing","action":"Tell the user to run: openclaw memory status --index or openclaw memory index --force."} consistently.
Technical investigation
- Error originates in
/usr/lib/node_modules/openclaw/dist/manager-dZw31DAG2.js(memory-core manager) - Code path:
resolveMemoryIndexIdentityState({meta, provider, providerKey, ...})returns{status:"missing", reason:"index metadata is missing"}whenmetais null - Manager sets
this.indexIdentityStateONCE at construction; subsequent reindex doesn't refresh it - SIGUSR1 restart signal does NOT trigger a re-read of the index identity state
indexIdentityStateis consulted at search time, so search returns the stale "missing" status
What works (workaround)
- CLI
openclaw memory search(uses fresh DB read each time) memory_gettool (file-based, not index-based)- REST API:
POST http://localhost:3111/agentmemory/search(direct, bypasses manager)
What doesn't work
agentmemory__memory_searchtool from any agent runtime- All reindex attempts
- All restart attempts (SIGUSR1, SIGTERM, systemctl, kill -9 + systemd auto-restart)
- npm update (already at latest)
Suggestion
Two possible fixes:
- In
manager-dZw31DAG2.js, add a periodic revalidation ofindexIdentityStateagainst the live DB (e.g., on each search, or every N minutes) - Make
updateIndexIdentityStatecallable from CLI/external trigger
Impact
Medium. The workaround is functional but the tool exposed to agents is essentially dead for search, requiring workaround via curl in shell commands. Multi-agent setups that rely on the search tool are affected.
Workaround (for users hitting this)
Documented at /root/.openclaw/workspace/main/runbooks/memory-search-workaround.md. Use memory_get for file reads and curl to REST API for semantic search.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 4, 2026
Thanks for writing this up. I checked the repo boundary, and this lives outside the OpenClaw source shell.
The named
agentmemory__memory_searchsurface is not implemented by OpenClaw, and current Memory Core already covers the earlier builtin stale-index mechanism; the remaining reports do not establish one reproducible OpenClaw-owned failure.So I’m closing this as outside the OpenClaw source repository rather than keeping it open as core work.
Review details
Best possible solution:
Report AgentMemory MCP/plugin failures to that package’s owner; open a focused OpenClaw report only with current-release
memory_searchoutput plus managerbackendand fallback status.Do we have a high-confidence way to reproduce the issue?
No for the named tool: current OpenClaw source has no
agentmemory__memory_searchimplementation to reproduce. The older builtin-manager sequence is covered by a current regression test.Is this the best way to solve the issue?
No; periodic revalidation in OpenClaw would not repair an externally installed AgentMemory tool, and current builtin Memory Core already refreshes its identity at search time.
Security review:
Security review: Issue triage; no proposed patch requires a security review.
AGENTS.md: found and applied where relevant.
What I checked:
memory_searchandmemory_get, notagentmemory__memory_search; repository searches found no AgentMemory package, extension, SDK surface, or configuration owner. (extensions/memory-core/index.ts:341, ce06e7924e88)extensions/memory-core/src/memory/manager.self-heal-missing-identity.test.ts:188, 39898fe91bd0)extensions/memory-core/src/memory/qmd-manager-io.ts:87, ce06e7924e88)Likely related people:
extensions/memory-core/src/memory/search-manager.ts,extensions/memory-core/src/memory/qmd-manager-io.ts)extensions/memory-core/src/memory/manager.ts,extensions/memory-core/src/memory/search-manager.ts)Codex review notes: model internal, reasoning high; reviewed against ce06e7924e88.
colinmac-boop commentedon Jun 5, 2026
Additional reproduction: macOS arm64, 2026.6.1
Environment
Reproduction
memory_searchtool returns"index metadata is missing"persistentlyopenclaw memory index --force→ rebuilds successfully, all agents showVector store: readyin CLIopenclaw gateway restart→ no change, tool still returns same erroropenclaw gateway stop && openclaw gateway start→ no change~/.openclaw/memory/*.sqlitefiles manually, re-ran--force→ error persistssqlite3 ~/.openclaw/memory/main.sqlite "PRAGMA integrity_check;"→okmetatable confirmed populated with correctprovider: openai,model: text-embedding-3-small, matching current gateway configopenclaw memory status --indexshowsVector store: readyandSemantic vectors: readyfor all agents except one which showsVector store: unknownWhat works
memory_get(file reads)openclaw memory status --indexreadtoolWhat doesn't work
memory_searchtool (bundled memory-core, not MCP extension)Note: The one agent showing
Vector store: unknownin CLI status is consistent across runs. Not sure if this is related.dr00-eth commentedon Jun 5, 2026
Opened #90727 for this persistent manager-cache path.
The patch makes the live memory manager refresh its SQLite file identity and reopen stale handles before status/search/sync when an external CLI/status manager has atomically rebuilt the index. It also fixes a safe-reindex metadata-cache bug where a fresh temp DB could miss
memory_index_meta_v1becauselastMetaSerializedstill matched the previous DB.Focused regression tests cover a live manager recovering after another manager rebuilds both missing-metadata and valid-metadata indexes.
wangwllu commentedon Jun 8, 2026
Additional data point: macOS arm64, 2026.6.x — config-drift trigger (no external rebuild)
Hitting the same
index metadata is missingfrom the bundledmemory_searchtool, but the trigger here is not an external CLI rebuild — it's plain config drift over a long-running gateway.Environment
2026.6.x(claude-cli runtime)openai-compatible→Qwen3-Embedding-8B(jdcloud-hosted)mainSymptom
memory_searchtool:disabled: true,error: "index metadata is missing", hint says to runopenclaw memory index --forceopenclaw memory status --indexis fully healthy:openai-compatibleQwen3-Embedding-8B53/53 files · 249 chunksnoreadyopenclaw memory search ... --jsonfrom CLI: works fine, returns hits.metatable hasmemory_index_meta_v1, integrity check OK.What did NOT trigger it
openclaw memory index --forcewas run before the failure.What appears to have triggered it
memorySearch.*config changed (provider/model/remote settings) at some earlier point during this gateway's lifetime, without a gateway restart.memory_searchtool kept reporting missing metadata.What fixed it
openclaw gateway restart— single shot, no--forcereindex, no DB touch. Tool recovered immediately and same query that was failing returned valid hits.Why I think this complements #90414 (and #90787 / #90042 / #90338)
indexIdentityStateis set once, reindex doesn't refresh it." ClawSweeper's review says current source already callsrefreshIndexIdentityDirtyat search time, so that specific explanation may be incomplete.memorySearch.provider/model/remote.*) is captured at gateway boot and is not refreshed when config changes during the gateway's lifetime. Once the index identity check compares "current adapter fingerprint vs DB meta," it can read a fingerprint that no longer matches the live config — even though the DB itself was written by the current config (because CLI tooling reads config fresh each time).Suggestion (small, narrowly-scoped)
Independent of the file-handle/refresh fix in #90727, add a config-change watcher (or just a hash check) on
memorySearch.provider,memorySearch.model, andmemorySearch.remote.*. On change, either:memory_searchrevalidates against current config rather than cached fingerprint, ormemory_searchis now potentially stale and agateway restartis required.Today the failure mode is silent: the tool just reports "index metadata is missing" with a hint to
--forcereindex (which doesn't help and can be misleading).Happy to test a patch on this setup if that helps.
AS76 commentedon Jun 8, 2026
Additional data point: Linux x64, DeepSeek V4 Flash, 2026.6.x — same error, live in production
Environment
deepseek/deepseek-v4-flash(primary model)cleo(main)Symptom
Same
"index metadata is missing"error on bundledmemory_searchtool. Occurs persistently.memory_getworks fineopenclaw memory status --indexwas not tested in this sessionRelevant context
This is a production instance active since before the 2026.6 release. Memory search was operational in 2026.5.x and broke after the 2026.6 update.
Trigger hypothesis
Config drift / upgrade-time mismatch is plausible given Lu Wang's report above — this gateway was upgraded in-place across releases without manual DB wipe, so the manager state cache likely carries stale identity metadata from the 2026.5 era.
Happy to test patches or provide more debug data.
33 remaining items
openclaw-barnacle commentedon Aug 12, 2026
Please publish this as a third-party plugin on ClawHub instead of adding it to the core repo. Docs: https://docs.openclaw.ai/plugin and https://docs.openclaw.ai/clawhub