Skip to content

memory.qmd.command path mangled on Windows — QMD memory backend unusable despite working CLI (CommonJS path concatenation strips separators) #92302

Closed

Description

@Ardooken

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Body:
Environment: OpenClaw 2026.6.5 (5181e4f), Windows 11, Node v24.14.1, @tobilu/qmd (npm global install)

Workaround: Set memory.backend = "builtin".
Notes: QMD's bin/qmd ships only as a shebang script with no .cmd/.ps1 Windows wrapper in node_modules/@tobilu/qmd/bin/, which compounds the issue — even if path resolution were fixed, direct node invocation of that file would still fail on the shebang line.

Steps to reproduce

Install OpenClaw 2026.6.5 on Windows 11, with @tobilu/qmd installed globally via npm.
In openclaw.json, set memory.backend to "qmd" and configure memory.qmd.command as the absolute path to qmd.js (or qmd.cmd), with one or more paths entries pointing to local markdown vaults.
Restart the OpenClaw gateway.
Run openclaw memory status — note the index shows 0/N files indexed.
Run openclaw memory index --force or openclaw memory search "".
Observe the error in the gateway log — the configured command path is mangled (separators stripped, concatenated with the workspace path) and the module cannot be found.
Repeat steps 2–6 with command set to the qmd.cmd wrapper instead of qmd.js — same mangling occurs.
Repeat with command omitted entirely — OpenClaw falls back to invoking node_modules/@tobilu/qmd/bin/qmd directly via node, which fails with a SyntaxError on the file's shebang line.
Separately, confirm qmd search "" run directly from PowerShell (with $env:XDG_CACHE_HOME set appropriately) returns correct results — confirming QMD itself is functional and the bug is isolated to OpenClaw's invocation.

Config:
json"memory": {
"backend": "qmd",
"qmd": {
"command": "C:\Users\\AppData\Roaming\npm\node_modules\@tobilu\qmd\dist\cli\qmd.js",
"paths": [
{ "name": "vault-1", "path": "G:\My Drive\Vault One", "pattern": "/*.md" },
{ "name": "vault-2", "path": "G:\My Drive\Vault Two", "pattern": "
/*.md" }
]
}
}

Expected behavior

Expected: OpenClaw spawns qmd using the configured command path and indexes the configured collections.
Actual: Every QMD invocation fails with a mangled path — backslashes stripped and the path concatenated with the workspace directory:
Error: Cannot find module 'C:\Users<user>.openclaw\workspace\UsersAppDataRoamingnpmnode_modules@tobiluqmddistcliqmd.js'
The intended path was C:\Users<user>\AppData\Roaming\npm\node_modules@tobilu\qmd\dist\cli\qmd.js. The command value appears to be treated as relative to workspace and joined without path separators, rather than recognised as an absolute Windows path.
Confirmed: QMD itself works fine. qmd search "..." from the command line (with $env:XDG_CACHE_HOME set to the existing index) returns correct JSON results. This is purely an OpenClaw invocation/path-resolution bug, not a QMD problem.

Things tried:
.js path as above — mangled as shown.
npm's auto-generated qmd.cmd wrapper as command — same mangling pattern, plus qmd binary unavailable... no executable/Node entrypoint could be resolved without shell execution.
Omitting command entirely — memory status reports Provider: qmd, index shows 0/N files, and memory index --force fails because OpenClaw invokes the raw bin/qmd file (a POSIX shebang script, not valid JS/CJS) directly via node, producing SyntaxError: Invalid or unexpected token on the # shebang comment.

Actual behavior

QMD never successfully indexes or searches when invoked through OpenClaw's memory.backend = "qmd" integration, regardless of how command is configured:

With command set to the .js path: fails with Error: Cannot find module 'C:\Users<user>.openclaw\workspace\UsersAppDataRoamingnpmnode_modules@tobiluqmddistcliqmd.js' — the absolute path has its separators stripped and is concatenated onto the workspace path.
With command set to the .cmd wrapper: same mangling pattern, plus an additional error — qmd binary unavailable... no executable/Node entrypoint could be resolved without shell execution.
With command omitted: memory status reports Provider: qmd and 0/N files indexed, and memory index --force / memory search fail with SyntaxError: Invalid or unexpected token — OpenClaw is invoking node_modules/@tobilu/qmd/bin/qmd (a POSIX shebang script) directly via node, which cannot parse the shebang comment line.

In all three cases the index remains empty (0/N files · 0 chunks) and every qmd collection add / qmd update call fails with one of the above errors. The only way to get a working memory backend is to set memory.backend = "builtin", which bypasses QMD entirely.

OpenClaw version

OpenClaw 2026.6.5 (5181e4f)

Operating system

windows 11

Install method

No response

Model

anthropic haiku

Provider / routing chain

na

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Activity

  1. clawsweeper commented on Jun 12, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 21, 2026, 7:46 AM ET / 11:46 UTC.

    Summary
    Keep this issue open: current main and the latest release still have the reported QMD command parser path, and two open clean PRs currently claim this issue with the same backend-config fix boundary.

    Reproducibility: yes. Current main routes memory.qmd.command through splitShellArgs, and that parser consumes unquoted backslashes before QMD spawn code sees the command; the issue discussion also includes Windows output using the exported parser.

    Root-cause cluster
    Relationship: canonical
    Canonical: #92302
    Summary: This issue is the canonical open report for Windows memory.qmd.command separator stripping in the QMD backend-config parser boundary.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Next step
    No new repair job should be queued because open linked PRs already target the exact parser boundary, with #95274 currently the strongest candidate.

    Review details

    Best possible solution:

    Land one canonical backend-config command-token fix, preferably #95274 if review remains clean, then close this issue as implemented.

    Do we have a high-confidence way to reproduce the issue?

    Yes. Current main routes memory.qmd.command through splitShellArgs, and that parser consumes unquoted backslashes before QMD spawn code sees the command; the issue discussion also includes Windows output using the exported parser.

    Is this the best way to solve the issue?

    Yes. The narrow maintainable fix is to preserve Windows drive-letter and UNC executable command tokens in backend config before shell-style parsing, rather than changing the shared parser globally or trying to repair the command later in spawn resolution.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • Multiple open PRs target the same parser boundary; maintainers should pick one canonical fix and close or supersede the rest after merge.
    • This read-only review did not run a live Windows QMD setup, so final landing should rely on the selected PR's Windows proof and CI state.

    Codex review notes: model internal, reasoning high; reviewed against d1cbe29f3d52.

    Label changes

    Label justifications:

    • P1: The issue blocks an existing QMD memory backend workflow on Windows while the documented absolute command path remains accepted configuration.
    • impact:other: The concrete impact is a disabled QMD memory backend on Windows, which is maintainer-visible but outside the narrower owned impact classes.
    Evidence reviewed

    What I checked:

    Likely related people:

    • bjesuiter: GitHub commit metadata ties commit 3e82cbd to the original quoted QMD command parsing and shell-argv use that now strips Windows separators. (role: introduced parser boundary; confidence: high; commits: 3e82cbd55bca; files: src/utils/shell-argv.ts, src/memory/backend-config.ts, packages/memory-host-sdk/src/host/backend-config.ts)
    • vignesh07: GitHub metadata for commit 3e82cbd lists Vignesh as committer, so this is useful routing context for the original QMD command parsing behavior. (role: committer on parser-boundary change; confidence: medium; commits: 3e82cbd55bca; files: src/utils/shell-argv.ts, src/memory/backend-config.ts)
    • steipete: Commit eebce9e moved the memory host resolver into packages/memory-host-sdk, which now owns the affected boundary. (role: major memory-host refactor author; confidence: medium; commits: eebce9e9c7cb; files: packages/memory-host-sdk/src/host/backend-config.ts, packages/memory-host-sdk/src/host/qmd-process.ts)
    • vincentkoc: Commit 8623c28 touched the QMD availability/process surfaces that consume the resolved command after backend-config parsing. (role: recent adjacent QMD memory contributor; confidence: high; commits: 8623c28f1d7d, c645ec4555c0; files: packages/memory-host-sdk/src/host/qmd-process.ts, extensions/memory-core/src/memory/search-manager.ts, extensions/memory-core/src/memory/qmd-manager.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    no-staleExclude from stale automation
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    and removed
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    on Jun 12, 2026
  3. Pick-cat commented on Jun 19, 2026

    @Pick-cat
    Contributor

    Reproduced on Windows — root cause confirmed

    The path mangling originates in splitShellArgs (src/utils/shell-argv.ts), a POSIX-style shell tokenizer that is used to parse memory.qmd.command in packages/memory-host-sdk/src/host/backend-config.ts:441-443:

    const rawCommand = qmdCfg?.command?.trim() || "qmd";
    const parsedCommand = splitShellArgs(rawCommand);
    const command = parsedCommand?.[0] || rawCommand.split(/\s+/)[0] || "qmd";

    When the configured value is an unquoted absolute Windows path, splitShellArgs treats every \ as a POSIX escape character and drops it (src/utils/shell-argv.ts:32-35):

    if (!inSingle && !inDouble && ch === "\\") {
      escaped = true;   // backslash consumed, not emitted
      continue;
    }

    So the path collapses into a single backslash-free token, which is then resolved relative to the workspace directory — producing the Cannot find module 'C:\Users\<user>\.openclaw\workspace\Users<user>AppData...' error in the report.

    Proof (Windows, using the actual exported splitShellArgs):

    platform           : win32 x64
    configured command : C:\Users\penny\AppData\Roaming\npm\node_modules\@tobilu\qmd\dist\cli\qmd.js
    derived command    : C:UserspennyAppDataRoamingnpmnode_modules@tobiluqmddistcliqmd.js
    separators present : false
    matches input      : false
    
    RESULT: FAIL — backslashes stripped, path mangled (#92302 reproduced)
    

    The derived C:Userspenny...qmd.js matches the reporter's mangled Users<user>AppDataRoamingnpmnode_modules@tobiluqmddistcliqmd.js exactly, confirming the bug is in OpenClaw's command parsing rather than in QMD.

    Suggested fix direction: don't run a POSIX shell splitter over a config value that is normally a bare path on Windows. Either detect an absolute Windows path and skip tokenizing, only split when the value is quoted or contains whitespace/flags, or normalize separators before tokenizing. A regression test feeding a C:\... path through backend-config would lock this down.

  4. added
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    and removed
    no-staleExclude from stale automation
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    on Jun 20, 2026
  5. striveagencyco-droid commented on Jun 21, 2026

    @striveagencyco-droid

    Since the command works in CLI but fails through the memory backend, I would log the exact command argv that OpenClaw is constructing before spawn.

    Good evidence to add:

    • configured memory.qmd.command with user paths redacted
    • the exact argv/cwd/env used by the backend spawn path
    • whether forward slashes vs escaped backslashes change behavior
    • whether wrapping the command in a .cmd or .ps1 shim avoids the path concatenation issue
    • Node version and whether the path is absolute, relative, or under a synced folder

    The key is to avoid testing only the human shell command; the failing surface is the programmatic spawn path and its cwd/env/path normalization.

  6. locked as resolved and limited conversation to collaborators on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions