{"record":{"id":"194b50b2bcfc6487","repo":"mozilla/pdf.js","slug":"unsupported-pattern-kind-kind","errorCode":null,"errorMessage":"Unsupported pattern kind: ${kind}","messagePattern":"Unsupported pattern kind: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/display/obj_bin_transform_display.js","lineNumber":426,"sourceCode":"      if (coords.length > 0) {\n        bounds = BBOX_INIT.slice();\n\n        for (let i = 0, ii = coords.length; i < ii; i += 2) {\n          Util.pointBoundingBox(coords[i], coords[i + 1], bounds);\n        }\n      }\n      return [\n        \"Mesh\",\n        shadingType,\n        coords,\n        colors,\n        nCoord,\n        bounds,\n        bbox,\n        background,\n      ];\n    }\n    throw new Error(`Unsupported pattern kind: ${kind}`);\n  }\n}\n\nclass FontPathInfo {\n  #buffer;\n\n  constructor(buffer) {\n    this.#buffer = buffer;\n  }\n\n  get path() {\n    if (\n      (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n      FeatureTest.isFloat16ArraySupported\n    ) {\n      return new Float16Array(this.#buffer);\n    }\n    return new Float32Array(this.#buffer);","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/display/obj_bin_transform_display.js#L408-L444","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await page.render({ canvasContext })?.promise;\n} catch (e) {\n  if (e.message.startsWith('Unsupported pattern kind')) {\n    // unsupported shading in this PDF; skip or render blank\n  }\n}","preventionTips":["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."],"tags":["rendering","shading-pattern","unsupported-pdf","ir"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}