{"record":{"id":"1b0917866a650683","repo":"mozilla/pdf.js","slug":"no-shading-object-found","errorCode":null,"errorMessage":"No shading object found","messagePattern":"No shading object found","errorType":"exception","errorClass":"FormatError","httpStatus":null,"severity":"error","filePath":"src/core/evaluator.js","lineNumber":2135,"sourceCode":"            }\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,\n              resources,\n              localColorSpaceCache,\n              localShadingPatternCache,\n            });\n            if (!patternId) {","sourceCodeStart":2117,"sourceCodeEnd":2153,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/evaluator.js#L2117-L2153","documentation":"FormatError thrown when shadingFill names a shading that does not exist in the Shading resource dictionary. A Shading resource is present, but the specific name (args[0].name) is not a key in it.","triggerScenarios":"shadingFill references shading name X, but shadingRes.get(X) returns nothing (typo, removed entry, or name from a different resource scope).","commonSituations":"Renamed shading entries, partial resource merging, or generators that emit a shading name without the matching Shading dict entry.","solutions":["Enable ignoreErrors: true so the dangling shading reference is skipped.","Repair the PDF: add the named shading entry to the Shading dictionary or correct the name.","Upgrade PDF.js."],"exampleFix":"// before\ngetDocument({ data }); // missing named shading aborts\n\n// after\ngetDocument({ data, ignoreErrors: true }); // missing shading skipped","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await page.render({ canvasContext, viewport }).promise;\n} catch (e) {\n  if (/No shading object found/.test(e.message)) {\n    await reloadWith({ ignoreErrors: true });\n  } else throw e;\n}","preventionTips":["Enable ignoreErrors for untrusted PDFs.","Repair Shading dictionaries that are missing referenced entries.","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"}