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 the CLI query-document parser when a lex:/vec:/hyde: line has a prefix but no query text. Each typed search line must contain its query on the same line.
Source
Thrown at src/cli/qmd.ts:2768
// Parse intent: lines
if (intentRe.test(line.trimmed)) {
if (intent !== undefined) {
throw new Error(`Line ${line.number}: only one intent: line is allowed per query document.`);
}
const text = line.trimmed.replace(intentRe, '').trim();
if (!text) {
throw new Error(`Line ${line.number}: intent: must include text.`);
}
intent = 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.`);
}
if (/\r|\n/.test(text)) {
throw new Error(`Line ${line.number} (${type}:) contains a newline. Keep each query on a single line.`);
}
typed.push({ type, query: text, line: line.number });
continue;
}
if (rawLines.length === 1) {
// Single plain line -> implicit expand
return null;
}
throw new Error(`Line ${line.number} is missing a lex:/vec:/hyde:/intent: prefix. Each line in a query document must start with one.`);
}
// intent: alone is not a valid query — must have at least one search
if (intent && typed.length === 0) {View on GitHub (pinned to dbfd0b4736)
Solutions
- Add the query text after the prefix
- Remove the empty line if that search is not wanted
Example fix
# before lex: vec: setup docs # after lex: how to install vec: setup docs
Defensive patterns
Strategy: validation
Validate before calling
if (/^\s*(lex|vec|hyde):\s*$/im.test(doc)) throw new Error('typed line missing text'); Type guard
const noEmptyTyped = (doc: string) => !/^\s*(lex|vec|hyde):\s*$/im.test(doc);
Prevention
- Trim and verify each prefixed line is non-empty before piping to qmd query
When it happens
Trigger: Piping 'lex:' or 'vec: ' as a line within a multi-line query document to `qmd query`.
Common situations: Template query documents never filled in; deleting query text while keeping prefixes.
Related errors
- Line ${line.number} starts with expand:, but query documents
- expand: query must include text.
- Line ${line.number}: only one intent: line is allowed per qu
- Line ${line.number}: intent: must include text.
- Line ${line.number} (${type}:) contains a newline. Keep each
AI-assisted analysis of tobi/qmd@dbfd0b4736 (2026-08-28).
Data as JSON: /api/errors/fc8941501a444427.
Report an issue: GitHub.