{"record":{"id":"205f7666710d209c","repo":"mozilla/pdf.js","slug":"the-api-version-apiversion-does-not-match-the","errorCode":null,"errorMessage":"The API version \"${apiVersion}\" does not match the Worker version \"${workerVersion}\".","messagePattern":"The API version \"(.+?)\" does not match the Worker version \"(.+?)\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/core/worker.js","lineNumber":124,"sourceCode":"    }\n  }\n\n  static createDocumentHandler(docParams, port) {\n    // This context is actually holds references on pdfManager and handler,\n    // until the latter is destroyed.\n    let pdfManager;\n    let terminated = false;\n    let cancelXHRs = null;\n    const WorkerTasks = new Set();\n    const verbosity = getVerbosityLevel();\n\n    const { docId, apiVersion } = docParams;\n    const workerVersion =\n      typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"TESTING\")\n        ? PDFJSDev.eval(\"BUNDLE_VERSION\")\n        : null;\n    if (apiVersion !== workerVersion) {\n      throw new Error(\n        `The API version \"${apiVersion}\" does not match ` +\n          `the Worker version \"${workerVersion}\".`\n      );\n    }\n\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      // Fail early, and predictably, rather than having (some) fonts fail to\n      // load/render with slightly cryptic error messages in environments where\n      // the `{Object, Array}.prototype` has been *incorrectly* extended.\n      //\n      // PLEASE NOTE: We do *not* want to slow down font parsing by adding\n      //              `Object.hasOwn` checks all over the code-base.\n      const buildMsg = (type, prop) =>\n        `The \\`${type}.prototype\\` contains unexpected enumerable property ` +\n        `\"${prop}\", thus breaking e.g. \\`for...in\\` iteration of ${type}s.`;\n\n      for (const prop in {}) {\n        throw new Error(buildMsg(\"Object\", prop));","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/worker.js#L106-L142","documentation":"Error \"The API version \"${apiVersion}\" does not match the Worker version \"${workerVersion}\".\" thrown in mozilla/pdf.js.","triggerScenarios":"Thrown at src/core/worker.js:124 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Load the matching pdf.worker build: the API (pdf.js) version and the worker (pdf.worker.js) version must be identical.","If using a bundler or CDN, pin both files to the same pdfjs-dist release and clear any stale cached worker file."],"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"}