{"record":{"id":"aa83e479eee9ece1","repo":"mozilla/pdf.js","slug":"no-shading-resource-found","errorCode":null,"errorMessage":"No shading resource found","messagePattern":"No shading resource found","errorType":"exception","errorClass":"FormatError","httpStatus":null,"severity":"error","filePath":"src/core/evaluator.js","lineNumber":2130,"sourceCode":"                  localShadingPatternCache,\n                  seenRefs\n                )\n              );\n              return;\n            }\n            if (!isNumberArray(args, null)) {\n              continue;\n            }\n            args = [cs.getRgbHex(args, 0)];\n            fn = OPS.setStrokeRGBColor;\n            break;\n\n          case OPS.shadingFill:\n            let shading;\n            try {\n              const shadingRes = resources.get(\"Shading\");\n              if (!shadingRes) {\n                throw new FormatError(\"No shading resource found\");\n              }\n\n              shading = shadingRes.get(args[0].name);\n              if (!shading) {\n                throw new FormatError(\"No shading object found\");\n              }\n            } catch (reason) {\n              if (reason instanceof AbortException) {\n                continue;\n              }\n              if (self.options.ignoreErrors) {\n                warn(`getOperatorList - ignoring Shading: \"${reason}\".`);\n                continue;\n              }\n              throw reason;\n            }\n            const patternId = self.parseShading({\n              shading,","sourceCodeStart":2112,"sourceCodeEnd":2148,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/evaluator.js#L2112-L2148","documentation":"FormatError thrown while processing the shadingFill operator when the page/resources dictionary has no 'Shading' entry at all. A shadingFill must reference a shading by name, so the absence of any Shading resource makes the operator unresolvable.","triggerScenarios":"A content stream contains a 'sh' (shadingFill) operator, but resources.get('Shading') returns nothing (no Shading sub-dictionary on this stream/page).","commonSituations":"Content streams whose resource dictionary was stripped or where shadingFill was left in after the Shading resource was removed; cross-page content reuse with mismatched resources.","solutions":["Enable ignoreErrors: true so the orphan shadingFill is skipped.","Repair the PDF: add the missing Shading resource dictionary or remove the shadingFill operator.","Upgrade PDF.js."],"exampleFix":"// before\ngetDocument({ data }); // shadingFill without Shading resource aborts\n\n// after\ngetDocument({ data, ignoreErrors: true }); // orphan shadingFill skipped","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await page.render({ canvasContext, viewport }).promise;\n} catch (e) {\n  if (/No shading resource found/.test(e.message)) {\n    await reloadWith({ ignoreErrors: true });\n  } else throw e;\n}","preventionTips":["Enable ignoreErrors for untrusted PDFs.","Repair PDFs that retain shadingFill after removing the Shading resource.","Upgrade PDF.js."],"tags":["pdf","shading","color","malformed-pdf","rendering"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}