{"record":{"id":"54ea63e91a2de9e0","repo":"toeverything/AFFiNE","slug":"could-not-get-blob","errorCode":null,"errorMessage":"Could not get blob","messagePattern":"Could not get blob","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/utils/resource.ts","lineNumber":9,"sourceCode":"import { fileTypeFromBuffer } from 'file-type';\n\nexport async function resourceUrlToBlob(\n  url: string\n): Promise<Blob | undefined> {\n  const buffer = await fetch(url).then(response => response.arrayBuffer());\n\n  if (!buffer) {\n    console.warn('Could not get blob');\n    return;\n  }\n  try {\n    const type = await fileTypeFromBuffer(buffer);\n    if (!type) {\n      return;\n    }\n    const blob = new Blob([buffer], { type: type.mime });\n    return blob;\n  } catch (error) {\n    console.error('Error converting resource to blob', error);\n  }\n  return;\n}\n\nexport async function downloadBlob(blob: Blob, filename: string) {\n  const blobUrl = URL.createObjectURL(blob);\n  const a = document.createElement('a');","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/utils/resource.ts#L1-L27","documentation":"Warning logged in `resourceUrlToBlob` when the fetched response yields an empty arrayBuffer, so there is no data to type-detect or wrap in a Blob. Returns undefined; callers receive no blob for that URL (dead link, empty response, or failed transfer).","triggerScenarios":"Triggered when resourceUrlToBlob fetches a URL but receives an empty arrayBuffer, so no blob can be constructed and undefined is returned.","commonSituations":"Occurs when converting a resource URL (e.g. for paste or import) that returns an empty or failed response. Check the resource URL and network, then retry.","solutions":["Verify the blob exists in storage before reading.","Retry after the blob finishes syncing."],"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-14T05:17:10.506Z"}