{"record":{"id":"36ddb94944393d57","repo":"mozilla/pdf.js","slug":"invalid-token-in-formcalc-expression-at-position","errorCode":null,"errorMessage":"Invalid token in FormCalc expression at position ${this.pos}.","messagePattern":"Invalid token in FormCalc expression at position (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/core/xfa/formcalc_lexer.js","lineNumber":174,"sourceCode":"    this.len = data.length;\n    this.strBuf = [];\n  }\n\n  skipUntilEOL() {\n    const match = this.data.slice(this.pos).match(eolPattern);\n    if (match) {\n      this.pos += match.index + match[0].length;\n    } else {\n      // No eol so consume all the chars.\n      this.pos = this.len;\n    }\n  }\n\n  getIdentifier() {\n    this.pos--;\n    const match = this.data.slice(this.pos).match(identifierPattern);\n    if (!match) {\n      throw new Error(\n        `Invalid token in FormCalc expression at position ${this.pos}.`\n      );\n    }\n\n    const identifier = this.data.slice(this.pos, this.pos + match[0].length);\n    this.pos += match[0].length;\n\n    const lower = identifier.toLowerCase();\n    if (!KEYWORDS.has(lower)) {\n      return new Token(TOKEN.identifier, identifier);\n    }\n\n    return Singletons[lower];\n  }\n\n  getString() {\n    const str = this.strBuf;\n    const data = this.data;","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/xfa/formcalc_lexer.js#L156-L192","documentation":"Error \"Invalid token in FormCalc expression at position ${this.pos}.\" thrown in mozilla/pdf.js.","triggerScenarios":"Thrown at src/core/xfa/formcalc_lexer.js:174 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the FormCalc expression syntax at the reported position; the lexer encountered characters that do not form a valid FormCalc token.","Check for unbalanced quotes, invalid identifiers, or unsupported characters in the calculate script."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}