tobi/qmd · error · Error
Line ${line.number} is missing a lex:/vec:/hyde:/intent: pre
Error message
Line ${line.number} is missing a lex:/vec:/hyde:/intent: prefix. What it means
Thrown when a line in a multi-line bench fixture query lacks any recognized prefix (lex:, vec:, hyde:, intent:). Single-line documents fall through and return undefined (treated as a plain query), but once there are multiple lines every line must be prefixed.
Source
Thrown at src/bench/bench.ts:86
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;
}
function uniqueFiles(files: string[], limit: number): string[] {
const seen = new Set<string>();
const out: string[] = [];
for (const file of files) {
if (seen.has(file)) continue;
seen.add(file);
out.push(file);
if (out.length >= limit) break;
}View on GitHub (pinned to dbfd0b4736)
Solutions
- Prefix the offending line with lex:, vec:, or hyde:
- Or remove the prose line so the query is a single unprefixed line
Example fix
// before "lex: install\nhow do I configure it" // after "lex: install\nlex: how do I configure it"
Defensive patterns
Strategy: validation
Validate before calling
const lines = doc.split('\n').filter(l => l.trim());
if (lines.length > 1) {
for (const l of lines) if (!/^\s*(lex|vec|hyde|intent):/i.test(l)) throw new Error(`unprefixed line: ${l}`);
} Type guard
const allLinesPrefixed = (doc: string) => doc.split('\n').every(l => !l.trim() || l.length === 1 || /^\s*(lex|vec|hyde|intent):/i.test(l) || doc.split('\n').filter(x=>x.trim()).length === 1); Prevention
- Remember: single-line documents may be unprefixed; multi-line documents must prefix every line
When it happens
Trigger: A fixture query like 'lex: install\nhow do I configure it' — the second line has no prefix and the document has more than one line.
Common situations: Appending a follow-up sentence to a typed query; forgetting to prefix an added search line; mixing prose and structured lines.
Related errors
- Line ${line.number}: only one intent: line is allowed per be
- Line ${line.number}: intent: must include text.
- Line ${line.number} (${type}:) must include text.
- intent: cannot appear alone. Add at least one lex:, vec:, or
- Invalid fixture: missing 'queries' array
AI-assisted analysis of tobi/qmd@dbfd0b4736 (2026-08-28).
Data as JSON: /api/errors/8e120f2d5e2da726.
Report an issue: GitHub.