openclaw - ✅(Solved) Fix [Bug]: memory-alt-writer collection registration fails with conflict warning on every gateway restart [1 pull requests, 1 comments, 1 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#58618Fetched 2026-04-08 02:00:07
View on GitHub
Comments
1
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×2closed ×1cross-referenced ×1locked ×1

Every time the gateway restarts, OpenClaw emits a warning:

00:29:19+00:00 warn memory {"subsystem":"memory"} qmd collection add skipped for memory-alt-writer: qmd collection add /Users/sompisjunsui/.openclaw/workspace --name memory-alt-writer --glob memory.md failed (code 1): A collection already exists for this path and pattern: Name: memory-root-writer (qmd://memory-root-writer/) Pattern: **/*.md

Use 'qmd update' to re-index it, or remove it first with 'qmd collection remove memory-root-writer'

00:29:21+00:00 warn memory {"subsystem":"memory"} qmd search failed: Error: qmd search exec approval notification behavior --json -n 8 -c memory-alt-writer failed (code 1): Collection not found: memory-alt-writer

00:29:21+00:00 warn memory {"subsystem":"memory"} qmd memory failed; switching to builtin index: qmd search exec approval notification behavior --json -n 8 -c memory-alt-writer failed (code 1): Collection not found: memory-alt-writer

Error Message

00:29:19+00:00 warn memory {"subsystem":"memory"} qmd collection add skipped for memory-alt-writer: qmd collection add /Users/sompisjunsui/.openclaw/workspace --name memory-alt-writer --glob memory.md failed (code 1): A collection already exists for this path and pattern: 00:29:21+00:00 warn memory {"subsystem":"memory"} qmd search failed: Error: qmd search exec approval notification behavior --json -n 8 -c memory-alt-writer failed (code 1): Collection not found: memory-alt-writer 00:29:21+00:00 warn memory {"subsystem":"memory"} qmd memory failed; switching to builtin index: qmd search exec approval notification behavior --json -n 8 -c memory-alt-writer failed (code 1): Collection not found: memory-alt-writer

Root Cause

memory-root-writer (glob **/*.md) registers first. memory-alt-writer (narrower pattern) fails because **/*.md already covers the same path. Warning fires every restart with no clean suppression path.

PR fix notes

PR #58736: fix(memory): prefer --mask over --glob for qmd collection pattern flag

Description (problem / solution / changelog)

Fixes #58618 Related #58643

Summary

  • Problem: QMD 2.0.1 accepts the --glob flag during collection add, but silently ignores it and falls back to the default **/*.md pattern. This causes strictly scoped collections (e.g., MEMORY.md) to be created as full-workspace collections instead.
  • Why it matters: It breaks multi-agent memory initialization. When OpenClaw tries to add a second collection under the same directory with a different pattern, QMD throws a path+pattern conflict, resulting in memory-alt-* registration failures on every gateway restart. It also silently pulls unintended files into the LLM memory context.
  • What changed: Defaulted collectionPatternFlag to --mask so OpenClaw uses the working flag first.
  • What did NOT change: The fallback mechanism is preserved for older environments where --mask might not be supported.

Change Type

  • Bug fix
  • Feature
  • Security hardening

Root Cause

collectionPatternFlag initializes as null, causing OpenClaw's negotiation logic to try --glob first. Because the qmd CLI does not exit with an error code when it ignores --glob, OpenClaw falsely assumes the flag succeeded and never falls back to --mask. Consequently, every collection is effectively created with the catch-all **/*.md pattern.

Evidence & Repro

Observed on gateway startup with QMD enabled. The narrower memory.md collection collides with an already-created memory-root-* collection:

12:05:19+08:00 [memory] qmd collection add skipped for memory-alt-tg: 
qmd collection add ~/.openclaw/workspace --name memory-alt-tg --glob memory.md failed (code 1): 
A collection already exists for this path and pattern:
Name: memory-root-tg (qmd://memory-root-tg/)
Pattern: **/*.md

Use 'qmd update' to re-index it, or remove it first with 'qmd collection remove memory-root-tg'

Expected: memory-root-* and memory-alt-* coexist in the same workspace targeting different patterns (**/.md vs MEMORY.md). Actual: The first collection is forced to **/.md, blocking the second.

Testing & Verification

  • Updated Tests: extensions/memory-core/src/memory/qmd-manager.test.ts
  • Added regression coverage to verify addCollection() correctly prefers --mask over --glob while preserving the fallback behavior.

Verification Steps:

  • Clear existing QMD collections (qmd collection remove ...).
  • Restart the gateway with multiple agents targeting the same workspace.
  • Verify that collections are successfully created without conflict warnings and strictly adhere to their intended patterns.

Compatibility / Risks

  • Backward compatible? Yes. If --mask fails, it falls back to --glob.
  • Migration needed? Users encountering the bug may need to clear their existing conflicting collections (qmd collection remove memory-root-<agent>) so they can be rebuilt correctly.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/memory-core/src/memory/qmd-manager.test.ts (modified, +13/-7)
  • extensions/memory-core/src/memory/qmd-manager.ts (modified, +1/-1)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Every time the gateway restarts, OpenClaw emits a warning:

00:29:19+00:00 warn memory {"subsystem":"memory"} qmd collection add skipped for memory-alt-writer: qmd collection add /Users/sompisjunsui/.openclaw/workspace --name memory-alt-writer --glob memory.md failed (code 1): A collection already exists for this path and pattern: Name: memory-root-writer (qmd://memory-root-writer/) Pattern: **/*.md

Use 'qmd update' to re-index it, or remove it first with 'qmd collection remove memory-root-writer'

00:29:21+00:00 warn memory {"subsystem":"memory"} qmd search failed: Error: qmd search exec approval notification behavior --json -n 8 -c memory-alt-writer failed (code 1): Collection not found: memory-alt-writer

00:29:21+00:00 warn memory {"subsystem":"memory"} qmd memory failed; switching to builtin index: qmd search exec approval notification behavior --json -n 8 -c memory-alt-writer failed (code 1): Collection not found: memory-alt-writer

Steps to reproduce

  1. Multi-agent setup with agent:main + at least one named agent (e.g. agent:writer)
  2. Restart the gateway
  3. Warning appears on every restart

Expected behavior

Detect conflict before registering duplicate collection — skip silently or deduplicate automatically.

Actual behavior

memory-root-writer (glob **/*.md) registers first. memory-alt-writer (narrower pattern) fails because **/*.md already covers the same path. Warning fires every restart with no clean suppression path.

OpenClaw version

2026.3.31

Operating system

macOS Darwin 25.4.0 (arm64)

Install method

No response

Model

anthropic/claude-sonnet-4-6

Provider / routing chain

openclaw -> local gateway -> anthropic/claude-sonnet-4-6

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

  • The issue can be mitigated by using the qmd update command to re-index the collection or removing the existing collection with qmd collection remove before attempting to add a new one.

Guidance

  • Verify the collection names and patterns to ensure there are no conflicts before restarting the gateway.
  • Use the qmd collection list command to check for existing collections and their patterns.
  • Consider implementing a check in the startup script to detect and handle duplicate collection registrations silently.
  • Review the OpenClaw documentation for any recommendations on managing collections and avoiding conflicts.

Example

  • No code snippet is provided as the issue does not require a code change, but rather a change in how collections are managed.

Notes

  • The provided OpenClaw version is 2026.3.31, and it is unclear if this issue is specific to this version or if it has been addressed in later versions.
  • The issue seems to be related to the specific setup and configuration of the OpenClaw instance, and the solution may vary depending on the exact requirements and constraints of the system.

Recommendation

  • Apply workaround: Use the qmd update command or remove existing collections to avoid conflicts, as this is a straightforward and effective way to mitigate the issue without requiring significant changes to the system.

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

Detect conflict before registering duplicate collection — skip silently or deduplicate automatically.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING