Skip to content

agentmemory__memory_search returns "index metadata is missing" persistently (memory-core manager state cache) #90414

Closed as not planned

Description

@AS76

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

  1. Fresh install / any state where ~/.openclaw/memory/{agent}.sqlite has empty meta table on gateway startup
  2. Run openclaw memory index --force to reindex all 12 agents (meta table populated, all 12 agents have 1 row with correct model: voyage-4-large, provider: voyage)
  3. Run openclaw memory search "anything" --agent cleo from CLI → works, returns results or "no matches"
  4. Call memory_search tool from agent runtime → returns "index metadata is missing"
  5. Try kill -USR1 <gateway_pid> → tool still returns same error
  6. Try systemctl --user restart openclaw-gateway → tool still returns same error after gateway comes back
  7. 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"} when meta is null
  • Manager sets this.indexIdentityState ONCE at construction; subsequent reindex doesn't refresh it
  • SIGUSR1 restart signal does NOT trigger a re-read of the index identity state
  • indexIdentityState is 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_get tool (file-based, not index-based)
  • REST API: POST http://localhost:3111/agentmemory/search (direct, bypasses manager)

What doesn't work

  • agentmemory__memory_search tool 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:

  1. In manager-dZw31DAG2.js, add a periodic revalidation of indexIdentityState against the live DB (e.g., on each search, or every N minutes)
  2. Make updateIndexIdentityState callable 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.

Activity

  1. clawsweeper commented on Jun 4, 2026

    @clawsweeper
    Contributor

    Thanks for writing this up. I checked the repo boundary, and this lives outside the OpenClaw source shell.

    The named agentmemory__memory_search surface 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_search output plus manager backend and 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_search implementation 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:

    Likely related people:

    • Peter Steinberger: Recent QMD and Memory Core refactor history connects this person to the backend boundary involved in the bundled-path analysis. (role: recent area contributor; confidence: medium; commits: e873a7f955f8; files: extensions/memory-core/src/memory/search-manager.ts, extensions/memory-core/src/memory/qmd-manager-io.ts)
    • Vincent Koc: Memory manager cache and fallback history, including co-authorship of the missing-identity repair, connects this person to the builtin path. (role: recent area contributor; confidence: medium; commits: 1a2eb74b9df6, 52f88473d98e; files: 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.

  2. added
    P2Normal backlog priority with limited blast radius.
    impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    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.
    on Jun 4, 2026
  3. colinmac-boop commented on Jun 5, 2026

    @colinmac-boop

    Additional reproduction: macOS arm64, 2026.6.1

    Environment

    • OpenClaw: 2026.6.1 (2e08f0f)
    • Platform: macOS Darwin 25.5.0 (arm64), Node v26.0.0
    • Shell: zsh
    • Memory plugin: bundled memory-core (not agentmemory MCP extension)

    Reproduction

    1. memory_search tool returns "index metadata is missing" persistently
    2. openclaw memory index --force → rebuilds successfully, all agents show Vector store: ready in CLI
    3. openclaw gateway restart → no change, tool still returns same error
    4. openclaw gateway stop && openclaw gateway start → no change
    5. Deleted all ~/.openclaw/memory/*.sqlite files manually, re-ran --force → error persists
    6. SQLite integrity check passes: sqlite3 ~/.openclaw/memory/main.sqlite "PRAGMA integrity_check;" → ok
    7. meta table confirmed populated with correct provider: openai, model: text-embedding-3-small, matching current gateway config
    8. CLI openclaw memory status --index shows Vector store: ready and Semantic vectors: ready for all agents except one which shows Vector store: unknown

    What works

    • memory_get (file reads)
    • CLI openclaw memory status --index
    • Direct file reads via read tool

    What doesn't work

    • memory_search tool (bundled memory-core, not MCP extension)

    Note: The one agent showing Vector store: unknown in CLI status is consistent across runs. Not sure if this is related.

  4. dr00-eth commented on Jun 5, 2026

    @dr00-eth
    Contributor

    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_v1 because lastMetaSerialized still matched the previous DB.

    Focused regression tests cover a live manager recovering after another manager rebuilds both missing-metadata and valid-metadata indexes.

  5. wangwllu commented on Jun 8, 2026

    @wangwllu
    Contributor

    Additional data point: macOS arm64, 2026.6.x — config-drift trigger (no external rebuild)

    Hitting the same index metadata is missing from the bundled memory_search tool, but the trigger here is not an external CLI rebuild — it's plain config drift over a long-running gateway.

    Environment

    • OpenClaw: 2026.6.x (claude-cli runtime)
    • Platform: macOS Darwin 25.4.0 (arm64), Node v26.0.0
    • Memory plugin: bundled memory-core
    • Embedding: openai-compatible → Qwen3-Embedding-8B (jdcloud-hosted)
    • Agent: main

    Symptom

    • Bundled memory_search tool: disabled: true, error: "index metadata is missing", hint says to run openclaw memory index --force
    • openclaw memory status --index is fully healthy:
      • Provider: openai-compatible
      • Model: Qwen3-Embedding-8B
      • Indexed: 53/53 files · 249 chunks
      • Dirty: no
      • Embeddings / Vector store / Semantic vectors / FTS: all ready
    • openclaw memory search ... --json from CLI: works fine, returns hits.
    • meta table has memory_index_meta_v1, integrity check OK.

    What did NOT trigger it

    • No openclaw memory index --force was run before the failure.
    • No atomic external rebuild / file swap.
    • No DB delete / re-create.

    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.
    • The gateway then ran for an extended period in this drifted state. CLI continued to read the live DB fine, but the live memory_search tool kept reporting missing metadata.

    What fixed it

    • openclaw gateway restart — single shot, no --force reindex, 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)

    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, and memorySearch.remote.*. On change, either:

    1. Tear down and rebuild the in-memory embedding adapter, or
    2. Mark the live manager state stale so the next memory_search revalidates against current config rather than cached fingerprint, or
    3. At minimum, log a WARN that the live memory_search is now potentially stale and a gateway restart is required.

    Today the failure mode is silent: the tool just reports "index metadata is missing" with a hint to --force reindex (which doesn't help and can be misleading).

    Happy to test a patch on this setup if that helps.

  6. AS76 commented on Jun 8, 2026

    @AS76
    ContributorAuthor

    Additional data point: Linux x64, DeepSeek V4 Flash, 2026.6.x — same error, live in production

    Environment

    • OpenClaw: 2026.6.x (srv1557712)
    • Platform: Linux 6.8.0-124-generic (x64), Node v22.22.3
    • Shell: bash
    • Memory plugin: bundled memory-core
    • Embedding: deepseek/deepseek-v4-flash (primary model)
    • Agent: cleo (main)

    Symptom
    Same "index metadata is missing" error on bundled memory_search tool. Occurs persistently.

    • memory_get works fine
    • CLI openclaw memory status --index was not tested in this session

    Relevant 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.

  7. added
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    and removed
    impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on Jun 15, 2026
  8. 33 remaining items

  9. added
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    clawsweeper:not-repro-on-mainClawSweeper found high-confidence evidence that this issue no longer reproduces on main.
    and removed
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    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.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    on Aug 5, 2026
  10. self-assigned this
    on Aug 12, 2026
  11. added
    r: third-party-extensionAuto-close: third-party plugins/capabilities belong on ClawHub.
    and removed
    clawsweeper:not-repro-on-mainClawSweeper found high-confidence evidence that this issue no longer reproduces on main.
    on Aug 12, 2026
  12. openclaw-barnacle commented on Aug 12, 2026

    @openclaw-barnacle

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.r: third-party-extensionAuto-close: third-party plugins/capabilities belong on ClawHub.

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions