worker-version-mismatch
- Type: error
- Kind:
usage(the caller did something the API doesn’t allow)
What happened
connect() from @laminapdf/sdk/worker started a worker, and the worker’s handshake named a different protocol or package version than the client. The client rejected connect() and sent nothing else.
Why
The client and the worker exchange messages whose shape belongs to one build. A worker from another version (an older deploy, a CDN copy, a worker bundled separately) could misread them, so the handshake fails loudly instead. That’s PDF.js’s version-mismatch lesson (L2a).
How to fix
Let the bundler serve the worker from the same @laminapdf/sdk package as the page: connect() contains the literal new Worker(new URL(…, import.meta.url)) that Vite and webpack follow. If you pass { worker } yourself, build it from the same package version.
Example
const client = await connect({ worker: new Worker("/old/lamina-worker.js", { type: "module" }) });// rejects: LaminaError { code: "worker-version-mismatch", … }Data fields
expected: the client’s{ protocol, version }.actual: what the worker answered.