{"record":{"id":"02bc32a7514a34bd","repo":"toeverything/AFFiNE","slug":"image-failed-to-load","errorCode":null,"errorMessage":"Image failed to load:","messagePattern":"Image failed to load:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"blocksuite/affine/shared/src/utils/print-to-pdf.ts","lineNumber":269,"sourceCode":"          }\n          if (\n            root instanceof view.HTMLElement ||\n            root instanceof view.ShadowRoot\n          ) {\n            root.childNodes.forEach(findImages);\n          }\n          if (root instanceof view.HTMLElement && root.shadowRoot) {\n            findImages(root.shadowRoot);\n          }\n        };\n\n        findImages(container);\n\n        await Promise.all(\n          images.map(img => {\n            if (img.complete) {\n              if (img.naturalWidth === 0) {\n                console.warn('Image failed to load:', img.src);\n              }\n              return Promise.resolve();\n            }\n            return new Promise(resolve => {\n              img.onload = resolve;\n              img.onerror = resolve;\n            });\n          })\n        );\n      };\n\n      await waitForImages(importedRoot);\n\n      // browser may take some time to load font or other resources\n      await (doc.fonts?.ready ??\n        new Promise<void>(resolve => {\n          setTimeout(() => {\n            resolve();","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/blocksuite/affine/shared/src/utils/print-to-pdf.ts#L251-L287","documentation":"Warning logged in `waitForImages` (used by printToPdf) for each image whose load failed — `img.complete` is true but `naturalWidth` is 0, meaning the src could not be loaded (broken URL, network error, or CORS). Printing continues without that image; it is a diagnostic, not an abort of the print flow.","triggerScenarios":"Triggered during print-to-PDF when an image element has completed loading but naturalWidth is 0, indicating the image resource failed to load.","commonSituations":"Occurs when printing a page whose images are broken or unreachable, so they are missing from the PDF. Check the image URLs and network before printing.","solutions":["Check the image URL is reachable and CORS-enabled.","Retry printing after the image loads."],"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"}