{"record":{"id":"4d6753b41c04ed01","repo":"toeverything/AFFiNE","slug":"failed-to-render-page","errorCode":null,"errorMessage":"Failed to render page","messagePattern":"Failed to render page","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/pdf/renderer/pdf.worker.ts","lineNumber":121,"sourceCode":"\n  open({ data }: { data: ArrayBuffer }) {\n    this.binary$.next(new Uint8Array(data));\n    return this.docInfo$;\n  }\n\n  render(opts: RenderPageOpts) {\n    return this.doc$.pipe(\n      combineLatestWith(this.viewer$),\n      switchMap(([doc, viewer]) => {\n        if (!doc) {\n          throw new Error('Document not opened');\n        }\n\n        return from(this.renderPage(viewer, doc, opts));\n      }),\n      map(bitmap => {\n        if (!bitmap) {\n          throw new Error('Failed to render page');\n        }\n\n        return transfer({ ...opts, bitmap }, [bitmap]);\n      })\n    );\n  }\n\n  async renderPage(viewer: Viewer, doc: Document, opts: RenderPageOpts) {\n    const page = doc.page(opts.pageNum);\n    if (!page) return;\n\n    const scale = opts.scale ?? 1;\n    const width = Math.ceil(opts.width * scale);\n    const height = Math.ceil(opts.height * scale);\n\n    const bitmap = viewer.createBitmap(width, height, 0);\n    bitmap.fill(0, 0, width, height);\n    page.render(","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/pdf/renderer/pdf.worker.ts#L103-L139","documentation":"A render-result guard in the PDF worker's render(): after renderPage resolved, the produced bitmap was falsy, meaning the native render call returned no usable output for the requested page. It fires when a page render silently produces nothing (e.g. invalid page number or render backend failure) rather than throwing natively — the worker converts that into this explicit error before transferring to the main thread.","triggerScenarios":"Thrown in the PDF worker render pipeline when renderPage produces no bitmap for the requested page, so nothing can be transferred back to the main thread.","commonSituations":"A PDF page fails to rasterize, often due to rendering limits or a problematic page. Try zooming out, reloading, or re-uploading the PDF.","solutions":["Retry rendering; check the PDF is not corrupt.","Reduce render scale if the canvas allocation fails."],"exampleFix":null,"handlingStrategy":"fallback","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"}