{"record":{"id":"4696d37922eb024d","repo":"toeverything/AFFiNE","slug":"page-not-found","errorCode":null,"errorMessage":"Page not found","messagePattern":"Page not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/pdf/renderer/pdf.worker.ts","lineNumber":83,"sourceCode":"    })\n  );\n\n  private readonly docInfo$: Observable<PDFMeta> = this.doc$.pipe(\n    map(doc => {\n      if (!doc) {\n        throw new Error('Document not opened');\n      }\n\n      const pageCount = doc.pageCount();\n      const pageSizes = [];\n      let i = 0;\n      let maxWidth = 0;\n      let maxHeight = 0;\n\n      for (; i < pageCount; i++) {\n        const page = doc.page(i);\n        if (!page) {\n          throw new Error('Page not found');\n        }\n        const size = page.size();\n        const width = Math.ceil(size.width);\n        const height = Math.ceil(size.height);\n\n        maxWidth = Math.max(maxWidth, width);\n        maxHeight = Math.max(maxHeight, height);\n\n        pageSizes.push({ width, height });\n        page.close();\n      }\n\n      return {\n        pageCount,\n        pageSizes,\n        maxSize: { width: maxWidth, height: maxHeight },\n      };\n    })","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/pdf/renderer/pdf.worker.ts#L65-L101","documentation":"In the PDF worker's docInfo$ loop, thrown when doc.page(i) returns null for an index below pageCount, meaning the underlying PDF document reports a page count but cannot supply that page — a corrupted or inconsistent document.","triggerScenarios":"Thrown while collecting document metadata in the PDF worker when doc.page(i) returns null for an index below the reported pageCount.","commonSituations":"Triggered by a malformed PDF whose pages cannot all be accessed during loading. Re-export or repair the PDF and upload it again.","solutions":["Request a page number within the document's page range.","Refresh the page count after loading the document."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}