{"record":{"id":"d02344a5588da71a","repo":"toeverything/AFFiNE","slug":"unknown-error-occurred","errorCode":null,"errorMessage":"Unknown error occurred","messagePattern":"Unknown error occurred","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/utils/reduce-image.ts","lineNumber":38,"sourceCode":"    const sizeInMB = file.size / (1024 * 1024);\n    if (sizeInMB > 10 || img.width > 4000 || img.height > 4000) {\n      // Compress the file to less than 10MB\n\n      try {\n        const compressedImg = await reduce().toBlob(file, {\n          max: 4000,\n          unsharpAmount: 80,\n          unsharpRadius: 0.6,\n          unsharpThreshold: 2,\n        });\n        return compressedImg;\n      } catch (error) {\n        if (error instanceof Error) {\n          throw new Error(\n            'Image processing failed. This can happen if fingerprint protection is enabled in your browser. Please check your browser settings and try again.'\n          );\n        } else {\n          throw new Error('Unknown error occurred');\n        }\n      }\n    }\n\n    return file;\n  };\n\n  const reducedBlob = await decodeAndReduceImage();\n\n  return new File([reducedBlob], file.name, {\n    type: file.type,\n    lastModified: file.lastModified,\n  });\n};\n","sourceCodeStart":20,"sourceCodeEnd":53,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/utils/reduce-image.ts#L20-L53","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the operation; check the console for the underlying error.","Report the issue with reproduction steps if it persists."],"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"}