mozilla/pdf.js · warning · Error
Unsupported pattern kind: ${kind}
Error message
Unsupported pattern kind: ${kind} What it means
Thrown by the display-layer shading-pattern IR transform when a pattern's `kind` is not one of the recognized kinds (the branch shown returns the 'Mesh' IR; anything else falls through). It indicates the worker produced a pattern intermediate-representation the display layer does not know how to render. This is effectively an unsupported-PDF-feature condition surfaced during rendering.
Source
Thrown at src/display/obj_bin_transform_display.js:426
if (coords.length > 0) {
bounds = BBOX_INIT.slice();
for (let i = 0, ii = coords.length; i < ii; i += 2) {
Util.pointBoundingBox(coords[i], coords[i + 1], bounds);
}
}
return [
"Mesh",
shadingType,
coords,
colors,
nCoord,
bounds,
bbox,
background,
];
}
throw new Error(`Unsupported pattern kind: ${kind}`);
}
}
class FontPathInfo {
#buffer;
constructor(buffer) {
this.#buffer = buffer;
}
get path() {
if (
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
FeatureTest.isFloat16ArraySupported
) {
return new Float16Array(this.#buffer);
}
return new Float32Array(this.#buffer);View on GitHub (pinned to 5903d58d58)
Solutions
- Ensure the worker build and API build are the same PDF.js version.
- Update to the latest PDF.js; newer versions handle more pattern kinds.
- Report the PDF to the PDF.js project so the kind can be supported.
- Catch render errors per-page so the rest of the document still renders.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await page.render({ canvasContext })?.promise;
} catch (e) {
if (e.message.startsWith('Unsupported pattern kind')) {
// unsupported shading in this PDF; skip or render blank
}
} Prevention
- Keep worker and API builds on the same PDF.js version.
- Catch per-page render errors so one bad page does not kill the viewer.
- Update PDF.js regularly to widen pattern coverage.
- Collect failing PDFs and report them upstream.
When it happens
Trigger: A PDF page contains a shading/tiling pattern whose serialized kind tag is not in the handled set; the transform switch falls through to the throw.
Common situations: A rare or malformed shading pattern type; a version skew between pdf.worker and the display layer; a PDF authored by a tool emitting a non-standard pattern kind.
Related errors
- Unknown IR type: ${IR[0]}
- Unsupported paint type: ${paintType}
- Image exceeded maximum allowed size and was removed.
- Unable to decode inline image: "${reason}".
- Type3 font load error: ${reason}
AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13).
Data as JSON: /api/errors/194b50b2bcfc6487.
Report an issue: GitHub.