{"record":{"id":"9918dec314ed9301","repo":"mozilla/pdf.js","slug":"postscript-function-a-procedure-block-must-be-fol","errorCode":null,"errorMessage":"PostScript function: a procedure block must be followed by 'if' or '{…} ifelse'.","messagePattern":"PostScript function: a procedure block must be followed by 'if' or '(.+?) ifelse'\\.","errorType":"exception","errorClass":"FormatError","httpStatus":null,"severity":"error","filePath":"src/core/postscript/ast.js","lineNumber":294,"sourceCode":"          break;\n\n        case TOKEN.lbrace: {\n          // Start of a sub-procedure: must be followed by 'if' or '{ } ifelse'.\n          this._advance();\n          const thenBlock = this._parseBlock();\n          this._expect(TOKEN.rbrace);\n\n          if (this._token.id === TOKEN.if) {\n            this._advance();\n            instructions.push(new PsIf(thenBlock));\n          } else if (this._token.id === TOKEN.lbrace) {\n            this._advance();\n            const elseBlock = this._parseBlock();\n            this._expect(TOKEN.rbrace);\n            this._expect(TOKEN.ifelse);\n            instructions.push(new PsIfElse(thenBlock, elseBlock));\n          } else {\n            throw new FormatError(\n              \"PostScript function: a procedure block must be followed by 'if' or '{…} ifelse'.\"\n            );\n          }\n          break;\n        }\n\n        case TOKEN.rbrace:\n        case TOKEN.eof:\n          // End of this block; let the caller consume the '}'.\n          return new PsBlock(instructions);\n\n        case TOKEN.if:\n        case TOKEN.ifelse:\n          // 'if'/'ifelse' without a preceding block.\n          throw new FormatError(\n            `PostScript function: unexpected '${tok.value}' operator.`\n          );\n","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/postscript/ast.js#L276-L312","documentation":"Error \"PostScript function: a procedure block must be followed by 'if' or '{…} ifelse'.\" thrown in mozilla/pdf.js.","triggerScenarios":"Thrown at src/core/postscript/ast.js:294 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["In the Type 4 function, follow each procedure block with `if` or use the `{...} {...} ifelse` form; a bare procedure is not allowed."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}