tobi/qmd · error · Error

Line ${line.number} (${type}:) must include text.

Error message

Line ${line.number} (${type}:) must include text.

What it means

Thrown by parseStructuredQuery when a line in a bench fixture matches the lex:/vec:/hyde: prefix but carries no query text. Every typed search line must include the actual query string after the prefix.

Source

Thrown at src/bench/bench.ts:76

  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;
    }

    throw new Error(`Line ${line.number} is missing a lex:/vec:/hyde:/intent: prefix.`);
  }

  if (intent && searches.length === 0) {
    throw new Error("intent: cannot appear alone. Add at least one lex:, vec:, or hyde: line.");
  }

  return searches.length > 0 ? { searches, intent } : undefined;
}

View on GitHub (pinned to dbfd0b4736)

Solutions

  1. Add the search text after the prefix (e.g. 'lex: how to install qmd')
  2. Remove the empty line if the search is not needed

Example fix

// before
"lex:"
// after
"lex: how to install qmd"
Defensive patterns

Strategy: validation

Validate before calling

if (/^\s*(lex|vec|hyde):\s*$/im.test(doc)) throw new Error('typed line missing query text');

Type guard

const noEmptyTypedLine = (doc: string) => !/^\s*(lex|vec|hyde):\s*$/im.test(doc);

Prevention

When it happens

Trigger: A fixture query document line like 'vec:' or 'lex: ' with nothing after the prefix.

Common situations: Template fixture files where the query text was never filled in; deleting query text but leaving the prefix skeleton.

Related errors


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