{"record":{"id":"11a4e4b1aecddf98","repo":"Foundry376/Mailspring","slug":"expected-token-got-tok-s","errorCode":null,"errorMessage":"Expected '${token}', got '${tok.s}'","messagePattern":"Expected '(.+?)', got '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/services/search/search-query-parser.ts","lineNumber":186,"sourceCode":" * to_query: TO COLON TEXT\n * subject_query: SUBJECT COLON TEXT\n * paren_query: LPAREN query RPAREN\n * is_query: IS COLON is_query_rest\n * is_query_rest: read_cond\n *              | starred_cond\n * has_query: HAS COLON ATTACHMENT\n * read_cond: READ | UNREAD\n * 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  }","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/Foundry376/Mailspring/blob/648c685d602ece6bb00c22534b8734de6ac644b3/app/src/services/search/search-query-parser.ts#L168-L204","documentation":"consumeExpectedToken mismatch: the parser expected a specific grammar token (e.g. a colon after 'from:', or a closing paren) at the current position and found something else. Indicates syntactically malformed user search input such as 'from' with no colon or unbalanced parentheses.","triggerScenarios":"Thrown at app/src/services/search/search-query-parser.ts:186 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the missing ':' or ')' indicated by the message","Quote search values containing spaces, e.g. from:\"John Doe\"","Balance all parentheses in the query"],"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"}