openclaw - ✅(Solved) Fix [Bug]: QMD backend falls back to builtin on live `openclaw memory search` due to managed collection mismatch (`memory-alt-main` vs `memory-root-main`) [1 pull requests, 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#65890Fetched 2026-04-14 05:39:42
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×2closed ×1commented ×1cross-referenced ×1

With memory.backend = "qmd", live openclaw memory search falls back to builtin because OpenClaw requests memory-alt-main while the managed QMD state reports an existing collection named memory-root-main for the same workspace path/pattern.

Error Message

qmd collection add skipped for memory-alt-main: qmd collection add /home/chris/.openclaw/workspace --name memory-alt-main --glob memory.md failed (code 1): A collection already exists for this path and pattern: Name: memory-root-main (qmd://memory-root-main/) Pattern: **/*.md ... qmd search failed: Error: qmd search Bert WSL IP --json -n 6 -c memory-alt-main failed (code 1): Collection not found: memory-alt-main ... qmd memory failed; switching to builtin index

Root Cause

With memory.backend = "qmd", live openclaw memory search falls back to builtin because OpenClaw requests memory-alt-main while the managed QMD state reports an existing collection named memory-root-main for the same workspace path/pattern.

Fix Action

Fix / Workaround

Observed managed QMD config file contents from ~/.openclaw/agents/main/qmd/xdg-config/qmd/index.yml before manual patch:

PR fix notes

PR #66141: fix(memory): unify default root memory handling

Description (problem / solution / changelog)

Summary

  • treat workspace root memory as a single slot instead of separate MEMORY.md and memory.md default QMD collections
  • make QMD prefer exact MEMORY.md, fall back to legacy lowercase memory.md only when the canonical file is absent, and stop generating/searching phantom memory-alt-* collections
  • align builtin memory file discovery with the same uppercase-first fallback rule so both backends share one root-memory model
  • harden QMD upgrade/rebind logic so legacy memory-alt collections that still own the root slot can be rebound to memory-root-* during repair

Why

OpenClaw had real source-of-truth drift around default root memory handling. The workspace/bootstrap rules already treat lowercase memory.md as legacy fallback only, but the QMD default collection resolver still modeled it as a second default collection. That let runtime search and repair target phantom memory-alt-* collections when only MEMORY.md existed.

User impact

  • removes noisy phantom QMD lookups and fallback-to-builtin behavior for normal MEMORY.md workspaces
  • keeps lowercase-only legacy workspaces working
  • makes builtin and QMD root-memory behavior consistent

Validation

  • pnpm test -- packages/memory-host-sdk/src/host/internal.test.ts
  • pnpm test -- packages/memory-host-sdk/src/host/backend-config.test.ts
  • pnpm test -- extensions/memory-core/src/memory/qmd-manager.test.ts
  • commit hook passed pnpm check

Related

  • #65913
  • #65908
  • #65890

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/memory-core/src/memory/qmd-manager.test.ts (modified, +165/-0)
  • extensions/memory-core/src/memory/qmd-manager.ts (modified, +73/-5)
  • packages/memory-host-sdk/src/host/backend-config.test.ts (modified, +88/-3)
  • packages/memory-host-sdk/src/host/backend-config.ts (modified, +35/-2)
  • packages/memory-host-sdk/src/host/internal.test.ts (modified, +19/-0)
  • packages/memory-host-sdk/src/host/internal.ts (modified, +25/-4)

Code Example

qmd collection add skipped for memory-alt-main: qmd collection add /home/chris/.openclaw/workspace --name memory-alt-main --glob memory.md failed (code 1): A collection already exists for this path and pattern:
  Name: memory-root-main (qmd://memory-root-main/)
  Pattern: **/*.md
...
qmd search failed: Error: qmd search Bert WSL IP --json -n 6 -c memory-alt-main failed (code 1): Collection not found: memory-alt-main
...
qmd memory failed; switching to builtin index

---

collections:
  memory-dir-main:
    path: /home/chris/.openclaw/workspace/memory
    pattern: "**/*.md"
  sessions-main:
    path: /home/chris/.openclaw/agents/main/qmd/sessions
    pattern: "**/*.md"
  memory-root-main:
    path: /home/chris/.openclaw/workspace
    pattern: "**/*.md"

---

Observed `openclaw memory search "Bert WSL IP"` output:


qmd collection add skipped for memory-alt-main: qmd collection add /home/chris/.openclaw/workspace --name memory-alt-main --glob memory.md failed (code 1): A collection already exists for this path and pattern:
  Name: memory-root-main (qmd://memory-root-main/)
  Pattern: **/*.md

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

qmd search failed: Error: qmd search Bert WSL IP --json -n 6 -c memory-alt-main failed (code 1): Collection not found: memory-alt-main

qmd memory failed; switching to builtin index


Observed `openclaw memory status --deep` after manually adding `memory-alt-main`:


Memory Search (main)
Provider: qmd (requested: qmd)
Model: qmd
Sources: memory, sessions
Indexed: 168/56 files · 168 chunks
Embeddings: ready
Vector: ready
QMD audit: ~/.openclaw/agents/main/qmd/xdg-cache/qmd/index.sqlite · 11173888 bytes · 4 collections


Observed managed QMD config file contents from `~/.openclaw/agents/main/qmd/xdg-config/qmd/index.yml` before manual patch:


collections:
  memory-dir-main:
    path: /home/chris/.openclaw/workspace/memory
    pattern: "**/*.md"
  sessions-main:
    path: /home/chris/.openclaw/agents/main/qmd/sessions
    pattern: "**/*.md"
  memory-root-main:
    path: /home/chris/.openclaw/workspace
    pattern: "**/*.md"


Observed standalone `qmd status` in shell:


Index: /home/chris/.cache/qmd/index.sqlite
Documents
  Total:    219 files indexed
  Vectors:  1762 embedded
Collections
  .openclaw (qmd://.openclaw/)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

With memory.backend = "qmd", live openclaw memory search falls back to builtin because OpenClaw requests memory-alt-main while the managed QMD state reports an existing collection named memory-root-main for the same workspace path/pattern.

Steps to reproduce

  1. Set memory.backend to "qmd" in openclaw.json.
  2. Restart the gateway with openclaw gateway restart.
  3. Run openclaw memory search "Bert WSL IP".
  4. Observe that the command logs a QMD collection mismatch for memory-alt-main, then reports qmd memory failed; switching to builtin index.

Expected behavior

If memory.backend is set to "qmd", openclaw memory search should execute against the managed QMD backend without logging qmd memory failed; switching to builtin index.

Actual behavior

openclaw memory search "Bert WSL IP" logs the following observed errors and then falls back to builtin results:

qmd collection add skipped for memory-alt-main: qmd collection add /home/chris/.openclaw/workspace --name memory-alt-main --glob memory.md failed (code 1): A collection already exists for this path and pattern:
  Name: memory-root-main (qmd://memory-root-main/)
  Pattern: **/*.md
...
qmd search failed: Error: qmd search Bert WSL IP --json -n 6 -c memory-alt-main failed (code 1): Collection not found: memory-alt-main
...
qmd memory failed; switching to builtin index

Observed managed QMD config contained:

collections:
  memory-dir-main:
    path: /home/chris/.openclaw/workspace/memory
    pattern: "**/*.md"
  sessions-main:
    path: /home/chris/.openclaw/agents/main/qmd/sessions
    pattern: "**/*.md"
  memory-root-main:
    path: /home/chris/.openclaw/workspace
    pattern: "**/*.md"

After manually adding memory-alt-main to the managed index.yml, openclaw memory status --deep showed QMD as active with embeddings/vector ready, but live openclaw memory search still logged the same collection-mismatch failure and fell back to builtin.

OpenClaw version

2026.4.11

Operating system

Ubuntu 24.04 in WSL2 on Windows

Install method

Global npm install under Node v24.14.1 (npm i -g openclaw@latest was used during debugging on Bert WSL)

Model

Memory backend under test: QMD

Provider / routing chain

OpenClaw main agent -> configured memory backend qmd -> OpenClaw-managed QMD state under ~/.openclaw/agents/main/qmd/... -> fallback to builtin memory when live QMD search fails

Additional provider/model setup details

  • OpenClaw was configured with memory.backend = "qmd" and QMD sessions enabled.
  • Managed QMD state path observed in status output: ~/.openclaw/agents/main/qmd/xdg-cache/qmd/index.sqlite.
  • Standalone qmd status in the user shell used a different QMD index at ~/.cache/qmd/index.sqlite and showed healthy collections/embeddings there.
  • QMD in WSL ran on CPU only. qmd status reported no GPU acceleration and a failed Vulkan build fallback.
  • The issue being reported here is the managed collection mismatch and fallback behavior, not the CPU-only acceleration warning.

Logs, screenshots, and evidence

Observed `openclaw memory search "Bert WSL IP"` output:


qmd collection add skipped for memory-alt-main: qmd collection add /home/chris/.openclaw/workspace --name memory-alt-main --glob memory.md failed (code 1): A collection already exists for this path and pattern:
  Name: memory-root-main (qmd://memory-root-main/)
  Pattern: **/*.md

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

qmd search failed: Error: qmd search Bert WSL IP --json -n 6 -c memory-alt-main failed (code 1): Collection not found: memory-alt-main

qmd memory failed; switching to builtin index


Observed `openclaw memory status --deep` after manually adding `memory-alt-main`:


Memory Search (main)
Provider: qmd (requested: qmd)
Model: qmd
Sources: memory, sessions
Indexed: 168/56 files · 168 chunks
Embeddings: ready
Vector: ready
QMD audit: ~/.openclaw/agents/main/qmd/xdg-cache/qmd/index.sqlite · 11173888 bytes · 4 collections


Observed managed QMD config file contents from `~/.openclaw/agents/main/qmd/xdg-config/qmd/index.yml` before manual patch:


collections:
  memory-dir-main:
    path: /home/chris/.openclaw/workspace/memory
    pattern: "**/*.md"
  sessions-main:
    path: /home/chris/.openclaw/agents/main/qmd/sessions
    pattern: "**/*.md"
  memory-root-main:
    path: /home/chris/.openclaw/workspace
    pattern: "**/*.md"


Observed standalone `qmd status` in shell:


Index: /home/chris/.cache/qmd/index.sqlite
Documents
  Total:    219 files indexed
  Vectors:  1762 embedded
Collections
  .openclaw (qmd://.openclaw/)

Impact and severity

When memory.backend is set to "qmd", live openclaw memory search can fail over to builtin instead of using QMD, even while status output suggests QMD is active. This affects reliability of the configured backend and makes it difficult to verify or use QMD as the actual memory engine. Severity appears moderate based on direct observation because memory search still returns results through builtin fallback, but the requested QMD backend is not reliably serving live queries.

Additional information

  • The issue was observed repeatedly across gateway restarts and a full wsl --shutdown / restart cycle.
  • Manual edits to the managed QMD index.yml improved status output but did not stop live searches from failing over to builtin.
  • Standalone QMD and OpenClaw-managed QMD appear to use different state directories, which may be relevant to triage.

extent analysis

TL;DR

The most likely fix is to ensure that the managed QMD state configuration matches the expected collection names and paths for the memory.backend = "qmd" setting.

Guidance

  1. Verify QMD collection configuration: Check the managed QMD config file (~/.openclaw/agents/main/qmd/xdg-config/qmd/index.yml) to ensure it contains the expected collection memory-alt-main with the correct path and pattern.
  2. Align collection names: Ensure that the collection names in the QMD configuration match the names expected by OpenClaw, specifically memory-alt-main for the memory.backend = "qmd" setting.
  3. Check for collection conflicts: Verify that there are no conflicting collections in the QMD configuration that might cause the memory-alt-main collection to be skipped or not found.
  4. Review OpenClaw logs: Examine the OpenClaw logs for any errors or warnings related to QMD collection management or search failures to identify potential issues.

Example

No specific code snippet is provided as the issue seems to be related to configuration and collection management rather than code.

Notes

  • The issue might be related to the difference in state directories used by standalone QMD and OpenClaw-managed QMD.
  • Manual edits to the managed QMD index.yml improved status output but did not resolve the live search fallback issue, indicating a potential discrepancy between the expected and actual QMD state.

Recommendation

Apply a workaround by manually ensuring the managed QMD state configuration matches the expected collection names and paths for the memory.backend = "qmd" setting, as this seems to be the most direct approach to resolving the collection mismatch and fallback behavior.

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

If memory.backend is set to "qmd", openclaw memory search should execute against the managed QMD backend without logging qmd memory failed; switching to builtin index.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING