Foundry376/Mailspring · error

Expected text but none available

Error message

Expected text but none available

What it means

Thrown by parseText in the search query parser when the grammar requires a TEXT token but nextToken returns null, meaning the remaining input string is empty (or only whitespace) at a point where a text argument is grammatically required. It is a generic end-of-input guard: the fault is the caller's input — a search query that ends (or runs out of non-whitespace content) where a text operand was expected, e.g. a dangling operator with no following term.

Source

Thrown at app/src/services/search/search-query-parser.ts:194

 * starred_cond: STARRED | UNSTARRED
 * in_query: IN COLON TEXT
 *
 * TEXT: STRING
 *     | [^\s]+
 * STRING: DQUOTE [^"]* DQUOTE
 */
const consumeExpectedToken = (text: string, token: string) => {
  const [tok, afterTok] = nextToken(text);
  if (tok.s !== token) {
    throw new Error(`Expected '${token}', got '${tok.s}'`);
  }
  return afterTok;
};

const parseText = (text: string): [TextQueryExpression, string] => {
  const [tok, afterTok] = nextToken(text);
  if (tok === null) {
    throw new Error('Expected text but none available');
  }
  return [new TextQueryExpression(tok), afterTok];
};

const parseIsQuery = (text: string): [QueryExpression, string] => {
  const afterColon = consumeExpectedToken(text, ':');
  const [tok, afterTok] = nextToken(afterColon);
  if (tok === null) {
    return null;
  }
  const tokText = tok.s.toUpperCase();
  switch (tokText) {
    case 'READ':
    case 'UNREAD': {
      return [new UnreadStatusQueryExpression(tokText === 'UNREAD'), afterTok];
    }
    case 'STARRED':
    case 'UNSTARRED': {

View on GitHub (pinned to 648c685d60)

Solutions

  1. Add a value after the field keyword, e.g. from:user@example.com
  2. Delete the dangling keyword if it was typed by mistake
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at app/src/services/search/search-query-parser.ts:194 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Foundry376/Mailspring@648c685d60 (2026-09-03). Data as JSON: /api/errors/9c02f2fd3a5bc30d. Report an issue: GitHub.