{"record":{"id":"c998b2615dae49c2","repo":"tobi/qmd","slug":"collection-collection-has-no-indexed-document","errorCode":null,"errorMessage":"Collection '${collection}' has no indexed documents.\\nRun 'qmd update', then 'qmd ls ${collection}' to confirm files are indexed before bench.","messagePattern":"Collection '(.+?)' has no indexed documents\\.\\\\nRun 'qmd update', then 'qmd ls (.+?)' to confirm files are indexed before bench\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/bench/bench.ts","lineNumber":297,"sourceCode":"/**\n * Fail fast when the fixture's collection is missing or empty so `qmd bench`\n * does not spend minutes printing a wall of 0.00 (#716).\n */\nexport function assertBenchCollectionReady(\n  collections: BenchCollectionInfo[],\n  collection?: string,\n): void {\n  if (collection) {\n    const match = collections.find(c => c.name === collection);\n    if (!match) {\n      const names = collections.map(c => c.name);\n      const hint = names.length > 0\n        ? `Available: ${names.join(\", \")}. Run 'qmd ls' to inspect.`\n        : \"Run 'qmd ls' to see available collections.\";\n      throw new Error(`Collection not found: ${collection}\\n${hint}`);\n    }\n    if (match.active_count === 0) {\n      throw new Error(\n        `Collection '${collection}' has no indexed documents.\\nRun 'qmd update', then 'qmd ls ${collection}' to confirm files are indexed before bench.`,\n      );\n    }\n    return;\n  }\n\n  const total = collections.reduce((n, c) => n + c.active_count, 0);\n  if (collections.length === 0 || total === 0) {\n    throw new Error(\n      \"No indexed documents found.\\nIndex a collection with 'qmd collection add' / 'qmd update' before running bench.\",\n    );\n  }\n}\n\nexport function benchSummaryAllZero(\n  summary: BenchmarkResult[\"summary\"],\n): boolean {\n  const entries = Object.values(summary);","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/tobi/qmd/blob/dbfd0b4736aeaf761d1a16ca8e424f071df8feb9/src/bench/bench.ts#L279-L315","documentation":"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.","triggerScenarios":"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.","commonSituations":"Collection added but never updated; --mask pattern matches no files; files were all filtered out (e.g. by ignore rules or the 10KB cap).","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"],"exampleFix":"# before\nqmd bench bench/fixture.json -c docs\n# after\nqmd update\nqmd ls docs\nqmd bench bench/fixture.json -c docs","handlingStrategy":"validation","validationCode":"const cols = JSON.parse(execSync('qmd collection list --format json').toString());\nconst c = cols.find(x => x.name === name);\nif (!c || c.active_count === 0) throw new Error('collection not indexed; run qmd update');","typeGuard":"const isReady = (c?: {active_count:number}) => !!c && c.active_count > 0;","tryCatchPattern":null,"preventionTips":["Always run qmd update and confirm active_count > 0 before bench","Check `qmd ls <collection>` output is non-empty in CI preflight"],"tags":["bench","collection","indexing"],"backgroundTag":"empty-index","analyzedSha":"dbfd0b4736aeaf761d1a16ca8e424f071df8feb9","analyzedAt":"2026-08-28T18:07:46.628Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}