toeverything/AFFiNE · error · Error

Unknown error occurred

Error message

Unknown error occurred

What it means

decodeAndReduceImage's catch-all: when the reduction throws a non-Error value (or the specific branch does not apply), it rethrows a generic 'Unknown error occurred' sentinel for image compression failures.

Source

Thrown at packages/frontend/core/src/utils/reduce-image.ts:38

    const sizeInMB = file.size / (1024 * 1024);
    if (sizeInMB > 10 || img.width > 4000 || img.height > 4000) {
      // Compress the file to less than 10MB

      try {
        const compressedImg = await reduce().toBlob(file, {
          max: 4000,
          unsharpAmount: 80,
          unsharpRadius: 0.6,
          unsharpThreshold: 2,
        });
        return compressedImg;
      } catch (error) {
        if (error instanceof Error) {
          throw new Error(
            'Image processing failed. This can happen if fingerprint protection is enabled in your browser. Please check your browser settings and try again.'
          );
        } else {
          throw new Error('Unknown error occurred');
        }
      }
    }

    return file;
  };

  const reducedBlob = await decodeAndReduceImage();

  return new File([reducedBlob], file.name, {
    type: file.type,
    lastModified: file.lastModified,
  });
};

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Retry the operation; check the console for the underlying error.
  2. Report the issue with reproduction steps if it persists.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown when image downscaling via browser-image-compression rejects with a non-Error value, so the code cannot produce the more specific fingerprint-protection message.

Common situations: A user uploads or pastes a large image and the compression step fails unexpectedly. Retry the upload or try a smaller image; in strict browsers, disabling fingerprint protection may help.


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