openclaw - 💡(How to fix) Fix QMD memory backend: managed collection naming mismatch causes Collection not found: memory-dir-main [1 comments, 2 participants]

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…
GitHub stats
openclaw/openclaw#59967Fetched 2026-04-08 02:38:13
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
1
Timeline (top)
commented ×1subscribed ×1

When OpenClaw is configured with memory.backend = "qmd", memory_search can fail because the Gateway expects managed collections such as:

  • memory-root-main
  • memory-alt-main
  • memory-dir-main

but the actual QMD collections may exist under different names (for example older / differently generated names such as memory-root, memory-alt, memory-dir, or user-created path-equivalent collections).

This causes memory search to fail with:

Collection not found: memory-dir-main

and OpenClaw falls back away from QMD even though the underlying QMD index may already be healthy.

Root Cause

This makes memory_search appear broken even though QMD itself may be working correctly. In our case, direct QMD search on the same index worked, while OpenClaw-managed search failed until the collection naming was manually aligned.

Fix Action

Fix / Workaround

Current workaround

Code Example

Collection not found: memory-dir-main

---

{
  memory: {
    backend: "qmd",
    qmd: {
      includeDefaultMemory: true,
      paths: [
        { name: "magi-shared", path: "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/MAGI/shared", pattern: "**/*.md" }
      ],
      searchMode: "search"
    }
  }
}

---

qmd search ... -c memory-dir-main failed (code 1): Collection not found: memory-dir-main

---

qmd collection add skipped for memory-dir-main: qmd collection add /Users/.../workspace/memory --name memory-dir-main --mask **/*.md failed (code 1): A collection already exists for this path and pattern

---

qmd search failed because a managed collection is missing; repairing collections and retrying once

---

qmd search ... -c memory-dir-main failed (code 1): Collection not found: memory-dir-main
RAW_BUFFERClick to expand / collapse

OpenClaw issue draft — QMD managed collection naming mismatch

Suggested title

QMD memory backend: managed collection naming mismatch causes Collection not found: memory-dir-main

Repository

  • Target: openclaw/openclaw

Summary

When OpenClaw is configured with memory.backend = "qmd", memory_search can fail because the Gateway expects managed collections such as:

  • memory-root-main
  • memory-alt-main
  • memory-dir-main

but the actual QMD collections may exist under different names (for example older / differently generated names such as memory-root, memory-alt, memory-dir, or user-created path-equivalent collections).

This causes memory search to fail with:

Collection not found: memory-dir-main

and OpenClaw falls back away from QMD even though the underlying QMD index may already be healthy.

Environment

  • OpenClaw version: 2026.4.2
  • QMD version: 2.0.1
  • OS: macOS
  • Install method: global / local gateway service

Relevant config shape

{
  memory: {
    backend: "qmd",
    qmd: {
      includeDefaultMemory: true,
      paths: [
        { name: "magi-shared", path: "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/MAGI/shared", pattern: "**/*.md" }
      ],
      searchMode: "search"
    }
  }
}

Steps to reproduce

  1. Enable memory.backend = "qmd"
  2. Start OpenClaw Gateway
  3. Let QMD initialize / index default memory files
  4. Trigger memory recall via memory_search or openclaw memory search
  5. Observe intermittent / immediate failure like:
qmd search ... -c memory-dir-main failed (code 1): Collection not found: memory-dir-main

Expected behavior

OpenClaw should either:

  • always create and use the same managed collection names it later searches for, or
  • repair / migrate mismatched collection names before searching, or
  • tolerate path-equivalent existing collections without getting stuck on naming mismatch.

Actual behavior

OpenClaw may try to search for memory-dir-main, while a different path-equivalent collection already exists. That can cause:

  • qmd collection add skipped ... A collection already exists for this path and pattern
  • followed by
  • Collection not found: memory-dir-main

This creates a broken state where:

  • the path is already indexed,
  • but the expected managed name is still missing,
  • so QMD search from OpenClaw fails.

Evidence from logs

Representative log pattern:

qmd collection add skipped for memory-dir-main: qmd collection add /Users/.../workspace/memory --name memory-dir-main --mask **/*.md failed (code 1): A collection already exists for this path and pattern

followed by:

qmd search failed because a managed collection is missing; repairing collections and retrying once

and then:

qmd search ... -c memory-dir-main failed (code 1): Collection not found: memory-dir-main

Why this matters

This makes memory_search appear broken even though QMD itself may be working correctly. In our case, direct QMD search on the same index worked, while OpenClaw-managed search failed until the collection naming was manually aligned.

Related known reports

This looks related to existing collection naming mismatch reports such as:

  • openclaw/openclaw#54942
  • openclaw/openclaw#20727

Suggested fix direction

  • Make managed collection naming deterministic and consistent between index creation and search
  • If a path-equivalent collection already exists, allow OpenClaw to rename / adopt it instead of repeatedly trying and skipping
  • Improve recovery logic so repairing collections and retrying once actually converges on a searchable state
  • Consider storing a path→managed-name mapping in the OpenClaw-side state instead of assuming the expected name always exists

Current workaround

Manual alignment of QMD collection names to the names OpenClaw expects (for example ensuring memory-dir-main actually exists) can restore search.

However, this is fragile and should not be required for normal users.

extent analysis

TL;DR

To fix the managed collection naming mismatch issue in OpenClaw, ensure that the collection names used for indexing and searching are consistent, potentially by adopting existing path-equivalent collections or storing a path-to-managed-name mapping.

Guidance

  1. Verify collection names: Check the actual names of the QMD collections and compare them with the names OpenClaw expects (e.g., memory-dir-main).
  2. Align collection names: Manually rename the QMD collections to match the expected names, or modify OpenClaw to adopt existing path-equivalent collections.
  3. Review OpenClaw configuration: Ensure the memory.backend is set to "qmd" and the qmd configuration is correctly defined, including includeDefaultMemory and paths.
  4. Test search functionality: After aligning collection names or modifying OpenClaw, test the memory_search functionality to verify that it works as expected.

Example

No specific code example is provided, as the issue is related to configuration and collection naming rather than code syntax.

Notes

The provided information suggests that the issue is related to the inconsistency between the expected collection names and the actual names of the QMD collections. The suggested fix direction involves making managed collection naming deterministic and consistent, which may require modifications to OpenClaw's collection management logic.

Recommendation

Apply a workaround by manually aligning the QMD collection names to the names OpenClaw expects, and consider modifying OpenClaw to adopt existing path-equivalent collections or store a path-to-managed-name mapping to prevent future naming mismatches. This approach allows for a temporary fix while a more permanent solution is developed.

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…

FAQ

Expected behavior

OpenClaw should either:

  • always create and use the same managed collection names it later searches for, or
  • repair / migrate mismatched collection names before searching, or
  • tolerate path-equivalent existing collections without getting stuck on naming mismatch.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix QMD memory backend: managed collection naming mismatch causes Collection not found: memory-dir-main [1 comments, 2 participants]