mozilla/pdf.js · error · Error
The API version "${apiVersion}" does not match the Worker ve
Error message
The API version "${apiVersion}" does not match the Worker version "${workerVersion}". What it means
Error "The API version "${apiVersion}" does not match the Worker version "${workerVersion}"." thrown in mozilla/pdf.js.
Source
Thrown at src/core/worker.js:124
}
}
static createDocumentHandler(docParams, port) {
// This context is actually holds references on pdfManager and handler,
// until the latter is destroyed.
let pdfManager;
let terminated = false;
let cancelXHRs = null;
const WorkerTasks = new Set();
const verbosity = getVerbosityLevel();
const { docId, apiVersion } = docParams;
const workerVersion =
typeof PDFJSDev !== "undefined" && !PDFJSDev.test("TESTING")
? PDFJSDev.eval("BUNDLE_VERSION")
: null;
if (apiVersion !== workerVersion) {
throw new Error(
`The API version "${apiVersion}" does not match ` +
`the Worker version "${workerVersion}".`
);
}
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// Fail early, and predictably, rather than having (some) fonts fail to
// load/render with slightly cryptic error messages in environments where
// the `{Object, Array}.prototype` has been *incorrectly* extended.
//
// PLEASE NOTE: We do *not* want to slow down font parsing by adding
// `Object.hasOwn` checks all over the code-base.
const buildMsg = (type, prop) =>
`The \`${type}.prototype\` contains unexpected enumerable property ` +
`"${prop}", thus breaking e.g. \`for...in\` iteration of ${type}s.`;
for (const prop in {}) {
throw new Error(buildMsg("Object", prop));View on GitHub (pinned to 5903d58d58)
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.
When it happens
Trigger: Thrown at src/core/worker.js:124 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13).
Data as JSON: /api/errors/205f7666710d209c.
Report an issue: GitHub.