{"record":{"id":"219b6e463df49e4e","repo":"tobi/qmd","slug":"line-line-number-intent-must-include-text-219b6e","errorCode":null,"errorMessage":"Line ${line.number}: intent: must include text.","messagePattern":"Line (.+?): intent: must include text\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/qmd.ts","lineNumber":2757,"sourceCode":"    if (expandRe.test(line.trimmed)) {\n      if (rawLines.length > 1) {\n        throw new Error(`Line ${line.number} starts with expand:, but query documents cannot mix expand with typed lines. Submit a single expand query instead.`);\n      }\n      const text = line.trimmed.replace(expandRe, '').trim();\n      if (!text) {\n        throw new Error('expand: query must include text.');\n      }\n      return null; // treat as standalone expand query\n    }\n\n    // Parse intent: lines\n    if (intentRe.test(line.trimmed)) {\n      if (intent !== undefined) {\n        throw new Error(`Line ${line.number}: only one intent: line is allowed per query document.`);\n      }\n      const text = line.trimmed.replace(intentRe, '').trim();\n      if (!text) {\n        throw new Error(`Line ${line.number}: intent: must include text.`);\n      }\n      intent = text;\n      continue;\n    }\n\n    const match = line.trimmed.match(prefixRe);\n    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      if (/\\r|\\n/.test(text)) {\n        throw new Error(`Line ${line.number} (${type}:) contains a newline. Keep each query on a single line.`);\n      }\n      typed.push({ type, query: text, line: line.number });\n      continue;\n    }","sourceCodeStart":2739,"sourceCodeEnd":2775,"githubUrl":"https://github.com/tobi/qmd/blob/dbfd0b4736aeaf761d1a16ca8e424f071df8feb9/src/cli/qmd.ts#L2739-L2775","documentation":"Thrown by the CLI query-document parser when an intent: line carries no text. Same rule as the bench parser: every prefixed line must include content.","triggerScenarios":"Piping 'intent:' with nothing after it as part of a query document to `qmd query`.","commonSituations":"Typos; empty shell variables interpolated after the prefix.","solutions":["Add text after intent: or delete the line","Quote and default variables in scripts: \"intent: ${INTENT:-general help}\""],"exampleFix":"# before\nlex: install\nintent:\n# after\nlex: install\nintent: find installation help","handlingStrategy":"validation","validationCode":"if (/^\\s*intent:\\s*$/m.test(doc)) throw new Error('empty intent: line');","typeGuard":"const noEmptyIntentLine = (doc: string) => !/^\\s*intent:\\s*$/m.test(doc);","tryCatchPattern":null,"preventionTips":["Guard shell interpolation: \"intent: ${INTENT:-help me find docs}\""],"tags":["query","cli","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"}