{"record":{"id":"e70e9db3567bb38f","repo":"Foundry376/Mailspring","slug":"expected-string-token-to-begin-with-double-quote","errorCode":null,"errorMessage":"Expected string token to begin with double quote (\")","messagePattern":"Expected string token to begin with double quote \\(\"\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/services/search/search-query-parser.ts","lineNumber":21,"sourceCode":"  OrQueryExpression,\n  NotQueryExpression,\n  AndQueryExpression,\n  FromQueryExpression,\n  ToQueryExpression,\n  SubjectQueryExpression,\n  GenericQueryExpression,\n  TextQueryExpression,\n  UnreadStatusQueryExpression,\n  StarredStatusQueryExpression,\n  DateQueryExpression,\n  InQueryExpression,\n  HasAttachmentQueryExpression,\n  QueryExpression,\n} from './search-query-ast';\n\nconst nextStringToken = (text: string): [SearchQueryToken, string] => {\n  if (text[0] !== '\"') {\n    throw new Error('Expected string token to begin with double quote (\")');\n  }\n  if (text.length < 2) {\n    throw new Error('Expected string but ran out of input');\n  }\n  let pos = 1;\n  while (pos < text.length) {\n    const c = text[pos];\n    if (c === '\"') {\n      return [new SearchQueryToken(text.substring(1, pos)), text.substring(pos + 1)];\n    }\n    pos += 1;\n  }\n  throw new Error('Expected string but ran out of input');\n};\n\nconst isWhitespace = (c) => {\n  switch (c) {\n    case ' ':","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/Foundry376/Mailspring/blob/648c685d602ece6bb00c22534b8734de6ac644b3/app/src/services/search/search-query-parser.ts#L3-L39","documentation":"Internal parser invariant in nextStringToken (search-query-parser): the function was called on input not starting with a double quote. nextToken should only route quoted-string parsing here after seeing a '\"', so this indicates a tokenizer bug rather than bad user input.","triggerScenarios":"Thrown at app/src/services/search/search-query-parser.ts:21 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report the query text that triggered it as a search-parser bug","Simplify the search query (remove unbalanced quotes/operators) as a workaround","Reproduce with the failing query string in the search test specs"],"exampleFix":null,"handlingStrategy":"try-catch","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"}