Foundry376/Mailspring · error

Unable to parse query

Error message

Unable to parse query

What it means

Top-level parse failure in parseQueryWrapper: the recursive-descent parser consumed no query expression at all from the input. Fires for empty/whitespace-only queries or input that matches no grammar rule from the very first token.

Source

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

const parseQuery = (text: string) => {
  return parseAndQuery(text);
};

const parseQueryWrapper = (text: string) => {
  let currText = text;
  const exps = [];
  while (currText.length > 0) {
    const [result, leftover] = parseQuery(currText);
    if (result === null) {
      break;
    }
    exps.push(result);
    currText = leftover;
  }

  if (exps.length === 0) {
    throw new Error('Unable to parse query');
  }

  let result: QueryExpression = null;
  for (let i = exps.length - 1; i >= 0; --i) {
    if (result === null) {
      result = exps[i];
    } else {
      result = new AndQueryExpression(exps[i], result);
    }
  }
  return result;
};

export class SearchQueryParser {
  static parse(query: string) {
    return parseQueryWrapper(query);
  }
}

View on GitHub (pinned to 648c685d60)

Solutions

  1. Enter a non-empty search query
  2. Use supported syntax: field:value terms (from:, to:, subject:, in:, is:, has:), quoted strings, and AND/OR/NOT parenthesized groups
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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