{"record":{"id":"39b9201668f9fbbd","repo":"tobi/qmd","slug":"intent-cannot-appear-alone-add-at-least-one-lex","errorCode":null,"errorMessage":"intent: cannot appear alone. Add at least one lex:, vec:, or hyde: line.","messagePattern":"intent: cannot appear alone\\. Add at least one lex:, vec:, or hyde: line\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/bench/bench.ts","lineNumber":90,"sourceCode":"    if (match) {\n      const type = match[1]!.toLowerCase() as \"lex\" | \"vec\" | \"hyde\";\n      const text = line.trimmed.slice(match[0].length).trim();\n      if (!text) {\n        throw new Error(`Line ${line.number} (${type}:) must include text.`);\n      }\n      searches.push({ type, query: text, line: line.number });\n      continue;\n    }\n\n    if (lines.length === 1) {\n      return undefined;\n    }\n\n    throw new Error(`Line ${line.number} is missing a lex:/vec:/hyde:/intent: prefix.`);\n  }\n\n  if (intent && searches.length === 0) {\n    throw new Error(\"intent: cannot appear alone. Add at least one lex:, vec:, or hyde: line.\");\n  }\n\n  return searches.length > 0 ? { searches, intent } : undefined;\n}\n\nfunction uniqueFiles(files: string[], limit: number): string[] {\n  const seen = new Set<string>();\n  const out: string[] = [];\n  for (const file of files) {\n    if (seen.has(file)) continue;\n    seen.add(file);\n    out.push(file);\n    if (out.length >= limit) break;\n  }\n  return out;\n}\n\nconst BACKENDS: Backend[] = [","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/tobi/qmd/blob/dbfd0b4736aeaf761d1a16ca8e424f071df8feb9/src/bench/bench.ts#L72-L108","documentation":"Thrown after parsing when a bench fixture query document contains an intent: line but zero typed search lines. intent: is metadata that sharpens ranking of lex:/vec:/hyde: searches and cannot stand alone.","triggerScenarios":"A fixture query document consisting solely of 'intent: find docs' with no lex:/vec:/hyde: lines.","commonSituations":"Writing an intent-only query expecting expansion; deleting the typed lines but keeping the intent annotation.","solutions":["Add at least one lex:, vec:, or hyde: line to the same query document","Use an expand: query (single line) if you want LLM query expansion instead"],"exampleFix":"// before\n\"intent: find setup docs\"\n// after\n\"intent: find setup docs\\nlex: setup documentation\"","handlingStrategy":"validation","validationCode":"const typed = (doc.match(/^\\s*(lex|vec|hyde):/gim) || []).length;\nconst intent = /^\\s*intent:/im.test(doc);\nif (intent && typed === 0) throw new Error('intent: requires at least one typed search line');","typeGuard":"const intentHasSearch = (doc: string) => !/^\\s*intent:/im.test(doc) || /^\\s*(lex|vec|hyde):/im.test(doc);","tryCatchPattern":null,"preventionTips":["Pair every intent: line with at least one lex:/vec:/hyde: line in fixtures"],"tags":["bench","fixture-validation","query-syntax"],"backgroundTag":"query-syntax-validation-failed","analyzedSha":"dbfd0b4736aeaf761d1a16ca8e424f071df8feb9","analyzedAt":"2026-08-28T18:07:46.628Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}