{"record":{"id":"6452be36730be44b","repo":"toeverything/AFFiNE","slug":"error-fetching-image","errorCode":null,"errorMessage":"Error fetching image:","messagePattern":"Error fetching image:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"blocksuite/affine/shared/src/adapters/utils/fetch.ts","lineNumber":24,"sourceCode":"    if (url.startsWith('blob:')) {\n      return await fetch(url, init);\n    }\n    if (url.startsWith('data:')) {\n      return await fetch(url, init);\n    }\n    if (url.startsWith(window.location.origin)) {\n      return await fetch(url, init);\n    }\n    return await fetch(proxy + '?url=' + encodeURIComponent(url), init)\n      .then(res => {\n        if (!res.ok) {\n          throw new Error('Network response was not ok');\n        }\n        return res;\n      })\n      .catch(() => fetch(url, init));\n  } catch (error) {\n    console.warn('Error fetching image:', error);\n    return null;\n  }\n};\n\nconst fetchable = (url: string) =>\n  url.startsWith('http:') ||\n  url.startsWith('https:') ||\n  url.startsWith('data:');\n\nexport const FetchUtils = {\n  fetchImage,\n  fetchable,\n};\n","sourceCodeStart":6,"sourceCodeEnd":38,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/blocksuite/affine/shared/src/adapters/utils/fetch.ts#L6-L38","documentation":"Warning logged in `fetchImage` when both fetch attempts fail: the proxied fetch returned a non-ok response (or threw) and the direct fallback fetch also threw (network error, CORS, invalid URL). Returns null so callers get no image; this is an expected degradation for unreachable or blocked image sources, not a crash.","triggerScenarios":"Triggered when fetchImageProxy fails to retrieve an image URL, even after falling back from the same-origin proxy to a direct fetch, returning null to the caller.","commonSituations":"Occurs when embedding or converting content whose remote images are unreachable, offline, or blocked by CORS. The image is omitted; check the URL and network connectivity.","solutions":["Check the image URL and network; retry the fetch.","Use a CORS-accessible image source."],"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"}