-
Notifications
You must be signed in to change notification settings - Fork 495
Open
Description
Bug
When qmd search --json "<query>" returns zero results, it outputs the plain text string "No results found." instead of an empty JSON array [].
This breaks any caller that expects valid JSON output when --json is specified.
Steps to Reproduce
- Run
qmd search --json "some query that returns no results" - Observe stdout is
No results found.(plain text) - Expected:
[](valid empty JSON array)
Root Cause
In src/qmd.ts (~line 1892), the empty results check prints plain text without checking the format flag:
if (resultsWithContext.length === 0) {
console.log("No results found."); // ignores opts.format
return;
}Suggested Fix
if (resultsWithContext.length === 0) {
if (opts.format === "json") console.log("[]");
else console.log("No results found.");
return;
}Impact
When QMD is used as a memory backend (e.g. via OpenClaw), the caller does JSON.parse(stdout) which throws on "No results found.". In our case this triggered a fallback to a 300MB CPU-based embedding model, causing ~2.5 minute delays on every empty-result query.
Environment
- QMD v1.0.0
- Runtime: Bun 1.3.9
- OS: Ubuntu 24.04
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels