{"record":{"id":"4723fc44d184abf8","repo":"toeverything/AFFiNE","slug":"document-not-opened","errorCode":null,"errorMessage":"Document not opened","messagePattern":"Document not opened","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/pdf/renderer/pdf.worker.ts","lineNumber":71,"sourceCode":"\n        observer.next(doc);\n\n        return () => {\n          setTimeout(() => {\n            doc.close();\n          }, 1000); // Waits for ObjectPool GC\n        };\n      });\n    }),\n    share({\n      connector: () => new ReplaySubject(1),\n    })\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);","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/pdf/renderer/pdf.worker.ts#L53-L89","documentation":"A document-availability guard inside the pdf.worker's docInfo$ pipeline: doc$ (a shared ReplaySubject of the opened PDF document) emitted a falsy value, meaning open() was never called with data or the document failed/closed before metadata extraction. It fires when metadata (page count/sizes) is requested before a document has been successfully opened in the worker backend.","triggerScenarios":"Thrown in the PDF renderer worker when viewer.open returns no document for the provided binary, or when docInfo/render is requested while doc$ holds no opened document.","commonSituations":"Occurs when a PDF fails to open in the viewer, typically due to corrupted or unsupported PDF data. Re-upload a valid PDF file and try again.","solutions":["Open the document in the PDF worker before requesting pages.","Re-initialize the renderer if the document was closed."],"exampleFix":null,"handlingStrategy":"validation","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"}