tobi/qmd · error · Error
Collection '${collection}' has no indexed documents.\nRun 'q
Error message
Collection '${collection}' has no indexed documents.\nRun 'qmd update', then 'qmd ls ${collection}' to confirm files are indexed before bench. What it means
Thrown when the named collection exists in the index but has zero active (indexed) documents. bench needs indexed content to run retrieval comparisons, so an empty collection aborts before scoring.
Source
Thrown at src/bench/bench.ts:297
/**
* Fail fast when the fixture's collection is missing or empty so `qmd bench`
* does not spend minutes printing a wall of 0.00 (#716).
*/
export function assertBenchCollectionReady(
collections: BenchCollectionInfo[],
collection?: string,
): void {
if (collection) {
const match = collections.find(c => c.name === collection);
if (!match) {
const names = collections.map(c => c.name);
const hint = names.length > 0
? `Available: ${names.join(", ")}. Run 'qmd ls' to inspect.`
: "Run 'qmd ls' to see available collections.";
throw new Error(`Collection not found: ${collection}\n${hint}`);
}
if (match.active_count === 0) {
throw new Error(
`Collection '${collection}' has no indexed documents.\nRun 'qmd update', then 'qmd ls ${collection}' to confirm files are indexed before bench.`,
);
}
return;
}
const total = collections.reduce((n, c) => n + c.active_count, 0);
if (collections.length === 0 || total === 0) {
throw new Error(
"No indexed documents found.\nIndex a collection with 'qmd collection add' / 'qmd update' before running bench.",
);
}
}
export function benchSummaryAllZero(
summary: BenchmarkResult["summary"],
): boolean {
const entries = Object.values(summary);View on GitHub (pinned to dbfd0b4736)
Solutions
- Run `qmd update` then `qmd ls <collection>` to confirm files appear
- If still empty, check the collection's mask: `qmd collection show <name>` and re-add with a matching --mask
- Verify the source directory actually contains files
Example fix
# before qmd bench bench/fixture.json -c docs # after qmd update qmd ls docs qmd bench bench/fixture.json -c docs
Defensive patterns
Strategy: validation
Validate before calling
const cols = JSON.parse(execSync('qmd collection list --format json').toString());
const c = cols.find(x => x.name === name);
if (!c || c.active_count === 0) throw new Error('collection not indexed; run qmd update'); Type guard
const isReady = (c?: {active_count:number}) => !!c && c.active_count > 0; Prevention
- Always run qmd update and confirm active_count > 0 before bench
- Check `qmd ls <collection>` output is non-empty in CI preflight
When it happens
Trigger: Running `qmd bench fixture.json -c docs` right after `qmd collection add` but before any `qmd update`, or when update indexed 0 files due to mask mismatch.
Common situations: Collection added but never updated; --mask pattern matches no files; files were all filtered out (e.g. by ignore rules or the 10KB cap).
Related errors
- Collection not found: ${collection}\n${hint}
- No indexed documents found.\nIndex a collection with 'qmd co
- OUTSIDE_COLLECTION
- OUTSIDE_COLLECTION
- ⚠ Skipped file outside collection: ${skipped.file}
AI-assisted analysis of tobi/qmd@dbfd0b4736 (2026-08-28).
Data as JSON: /api/errors/c998b2615dae49c2.
Report an issue: GitHub.