{"record":{"id":"db9b4df3ac5d0275","repo":"mozilla/pdf.js","slug":"command-token-too-long-str-length","errorCode":null,"errorMessage":"Command token too long: ${str.length}","messagePattern":"Command token too long: (.+?)","errorType":"exception","errorClass":"FormatError","httpStatus":null,"severity":"error","filePath":"src/core/parser.js","lineNumber":1378,"sourceCode":"    // and the next character may be (the start of) a valid command.\n    if (ch < 0x20 || ch > 0x7f) {\n      const nextCh = this.peekChar();\n      if (nextCh >= 0x20 && nextCh <= 0x7f) {\n        this.nextChar();\n        return Cmd.get(str);\n      }\n    }\n    const knownCommands = this.knownCommands;\n    let knownCommandFound = knownCommands?.[str] !== undefined;\n    while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {\n      // Stop if a known command is found and next character does not make\n      // the string a command.\n      const possibleCommand = str + String.fromCharCode(ch);\n      if (knownCommandFound && knownCommands[possibleCommand] === undefined) {\n        break;\n      }\n      if (str.length === 128) {\n        throw new FormatError(`Command token too long: ${str.length}`);\n      }\n      str = possibleCommand;\n      knownCommandFound = knownCommands?.[str] !== undefined;\n    }\n    if (str === \"true\") {\n      return true;\n    }\n    if (str === \"false\") {\n      return false;\n    }\n    if (str === \"null\") {\n      return null;\n    }\n\n    if (str === \"BI\") {\n      // Keep track of the current stream position, since it's needed in order\n      // to correctly cache inline images; see `Parser.makeInlineImage`.\n      this.beginInlineImagePos = this.stream.pos;","sourceCodeStart":1360,"sourceCodeEnd":1396,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/parser.js#L1360-L1396","documentation":"Error \"Command token too long: ${str.length}\" thrown in mozilla/pdf.js.","triggerScenarios":"Thrown at src/core/parser.js:1378 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Shorten the offending operator/keyword token; PDF command tokens must not exceed the maximum token length.","Check for missing whitespace between tokens in the content stream and fix the generator that emitted the run-on token."],"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"}