Foundry376/Mailspring · error
Expected string but ran out of input
Error message
Expected string but ran out of input
What it means
nextStringToken found an opening double quote but the input ended before any content or closing quote — i.e. a quoted string in the search query is truncated ('from: "foo'). Raised while tokenizing the user's search query.
Source
Thrown at app/src/services/search/search-query-parser.ts:24
FromQueryExpression,
ToQueryExpression,
SubjectQueryExpression,
GenericQueryExpression,
TextQueryExpression,
UnreadStatusQueryExpression,
StarredStatusQueryExpression,
DateQueryExpression,
InQueryExpression,
HasAttachmentQueryExpression,
QueryExpression,
} from './search-query-ast';
const nextStringToken = (text: string): [SearchQueryToken, string] => {
if (text[0] !== '"') {
throw new Error('Expected string token to begin with double quote (")');
}
if (text.length < 2) {
throw new Error('Expected string but ran out of input');
}
let pos = 1;
while (pos < text.length) {
const c = text[pos];
if (c === '"') {
return [new SearchQueryToken(text.substring(1, pos)), text.substring(pos + 1)];
}
pos += 1;
}
throw new Error('Expected string but ran out of input');
};
const isWhitespace = (c) => {
switch (c) {
case ' ':
case '\t':
case '\n':
return true;View on GitHub (pinned to 648c685d60)
Solutions
- Close the unclosed double quote in the search query
- Remove the trailing quote if the value was not meant to be quoted
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/src/services/search/search-query-parser.ts:24 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/ba36ae12045fb127.
Report an issue: GitHub.