toeverything/AFFiNE · error

Could not get blob

Error message

Could not get blob

What it means

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).

Source

Thrown at packages/frontend/core/src/utils/resource.ts:9

import { fileTypeFromBuffer } from 'file-type';

export async function resourceUrlToBlob(
  url: string
): Promise<Blob | undefined> {
  const buffer = await fetch(url).then(response => response.arrayBuffer());

  if (!buffer) {
    console.warn('Could not get blob');
    return;
  }
  try {
    const type = await fileTypeFromBuffer(buffer);
    if (!type) {
      return;
    }
    const blob = new Blob([buffer], { type: type.mime });
    return blob;
  } catch (error) {
    console.error('Error converting resource to blob', error);
  }
  return;
}

export async function downloadBlob(blob: Blob, filename: string) {
  const blobUrl = URL.createObjectURL(blob);
  const a = document.createElement('a');

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Verify the blob exists in storage before reading.
  2. Retry after the blob finishes syncing.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Triggered when resourceUrlToBlob fetches a URL but receives an empty arrayBuffer, so no blob can be constructed and undefined is returned.

Common situations: 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.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/54ea63e91a2de9e0. Report an issue: GitHub.