{"record":{"id":"610da35d813b1f83","repo":"toeverything/AFFiNE","slug":"a-fatal-error-for-blocksuite-occurs-please-contac","errorCode":null,"errorMessage":"A fatal error for BlockSuite occurs, please contact the team if you find this.","messagePattern":"A fatal error for BlockSuite occurs, please contact the team if you find this\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"blocksuite/framework/global/src/exceptions/index.ts","lineNumber":24,"sourceCode":"  code: ErrorCode;\n\n  isFatal: boolean;\n\n  constructor(code: ErrorCode, message: string, options?: { cause: Error }) {\n    super(message, options);\n    this.name = 'BlockSuiteError';\n    this.code = code;\n    this.isFatal = code >= 10000;\n  }\n}\n\nexport function handleError(error: Error) {\n  if (!(error instanceof BlockSuiteError)) {\n    throw error;\n  }\n\n  if (error.isFatal) {\n    throw new Error(\n      'A fatal error for BlockSuite occurs, please contact the team if you find this.',\n      { cause: error }\n    );\n  }\n\n  console.error(\n    \"A runtime error for BlockSuite occurs, you can ignore this error if it won't break the user experience.\"\n  );\n  console.error(error.stack);\n}\n\nexport * from './code.js';\n","sourceCodeStart":6,"sourceCodeEnd":37,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/blocksuite/framework/global/src/exceptions/index.ts#L6-L37","documentation":"handleError converts any BlockSuiteError with a fatal code (>= 10000) into a generic fatal Error that preserves the original as cause; non-fatal BlockSuiteErrors are only logged. It is the framework's last-resort escalation for unrecoverable internal failures.","triggerScenarios":"Thrown at blocksuite/framework/global/src/exceptions/index.ts:24 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Capture the wrapped error's message and stack trace before reporting — this generic exception always wraps a more specific cause.","Update BlockSuite to the latest version; many fatal internal errors are fixed upstream.","Report the issue at https://github.com/toeverything/blocksuite/issues with the original error and reproduction steps."],"exampleFix":"try {\n  editor.host.render();\n} catch (e) {\n  console.error('BlockSuite fatal error, wrapped cause:', e);\n  // Report with the original error details, not just the generic message\n}","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"}