tobi/qmd · error · Error

Line ${line.number}: intent: must include text.

Error message

Line ${line.number}: intent: must include text.

What it means

Thrown when a line in a bench fixture query starts with 'intent:' but has no text after the colon. The parser requires every prefixed line to carry content, so a bare 'intent:' is rejected at that line number.

Source

Thrown at src/bench/bench.ts:66

    trimmed: line.trim(),
    number: idx + 1,
  })).filter(line => line.trimmed.length > 0);

  if (lines.length === 0) return undefined;

  const prefixRe = /^(lex|vec|hyde):\s*/i;
  const intentRe = /^intent:\s*/i;
  const searches: ExpandedQuery[] = [];
  let intent: string | undefined;

  for (const line of lines) {
    if (intentRe.test(line.trimmed)) {
      if (intent !== undefined) {
        throw new Error(`Line ${line.number}: only one intent: line is allowed per benchmark query.`);
      }
      intent = line.trimmed.replace(intentRe, "").trim();
      if (!intent) {
        throw new Error(`Line ${line.number}: intent: must include text.`);
      }
      continue;
    }

    const match = line.trimmed.match(prefixRe);
    if (match) {
      const type = match[1]!.toLowerCase() as "lex" | "vec" | "hyde";
      const text = line.trimmed.slice(match[0].length).trim();
      if (!text) {
        throw new Error(`Line ${line.number} (${type}:) must include text.`);
      }
      searches.push({ type, query: text, line: line.number });
      continue;
    }

    if (lines.length === 1) {
      return undefined;
    }

View on GitHub (pinned to dbfd0b4736)

Solutions

  1. Add descriptive text after intent: or delete the line entirely
  2. Lint fixture files for empty prefixes before running qmd bench

Example fix

// before
"lex: install\nintent:"
// after
"lex: install\nintent: find installation docs"
Defensive patterns

Strategy: validation

Validate before calling

if (/^\s*intent:\s*$/m.test(doc)) throw new Error('empty intent: line in fixture query');

Type guard

const noEmptyIntent = (doc: string) => !/^\s*intent:\s*$/m.test(doc);

Prevention

When it happens

Trigger: A query document in the fixture contains 'intent:' with nothing (or only whitespace) after it, e.g. 'lex: foo\nintent:'.

Common situations: Typos or half-edited fixture files; trailing empty intent lines left after deleting intent text.

Related errors


AI-assisted analysis of tobi/qmd@dbfd0b4736 (2026-08-28). Data as JSON: /api/errors/fd263c73346a7fc3. Report an issue: GitHub.