{"record":{"id":"9c02f2fd3a5bc30d","repo":"Foundry376/Mailspring","slug":"expected-text-but-none-available","errorCode":null,"errorMessage":"Expected text but none available","messagePattern":"Expected text but none available","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/services/search/search-query-parser.ts","lineNumber":194,"sourceCode":" * starred_cond: STARRED | UNSTARRED\n * in_query: IN COLON TEXT\n *\n * TEXT: STRING\n *     | [^\\s]+\n * STRING: DQUOTE [^\"]* DQUOTE\n */\nconst consumeExpectedToken = (text: string, token: string) => {\n  const [tok, afterTok] = nextToken(text);\n  if (tok.s !== token) {\n    throw new Error(`Expected '${token}', got '${tok.s}'`);\n  }\n  return afterTok;\n};\n\nconst parseText = (text: string): [TextQueryExpression, string] => {\n  const [tok, afterTok] = nextToken(text);\n  if (tok === null) {\n    throw new Error('Expected text but none available');\n  }\n  return [new TextQueryExpression(tok), afterTok];\n};\n\nconst parseIsQuery = (text: string): [QueryExpression, string] => {\n  const afterColon = consumeExpectedToken(text, ':');\n  const [tok, afterTok] = nextToken(afterColon);\n  if (tok === null) {\n    return null;\n  }\n  const tokText = tok.s.toUpperCase();\n  switch (tokText) {\n    case 'READ':\n    case 'UNREAD': {\n      return [new UnreadStatusQueryExpression(tokText === 'UNREAD'), afterTok];\n    }\n    case 'STARRED':\n    case 'UNSTARRED': {","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/Foundry376/Mailspring/blob/648c685d602ece6bb00c22534b8734de6ac644b3/app/src/services/search/search-query-parser.ts#L176-L212","documentation":"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.","triggerScenarios":"Thrown at app/src/services/search/search-query-parser.ts:194 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a value after the field keyword, e.g. from:user@example.com","Delete the dangling keyword if it was typed by mistake"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"648c685d602ece6bb00c22534b8734de6ac644b3","analyzedAt":"2026-09-03T02:00:24.311Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}