{"record":{"id":"7d710181484d00b1","repo":"toeverything/AFFiNE","slug":"failed-to-check-user-by-email-email","errorCode":null,"errorMessage":"Failed to check user by email: ${email}","messagePattern":"Failed to check user by email: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/cloud/stores/auth.ts","lineNumber":219,"sourceCode":"      variables: {\n        input: {\n          name: label,\n        },\n      },\n    });\n  }\n\n  async checkUserByEmail(email: string) {\n    const res = await this.fetchService.fetch('/api/auth/preflight', {\n      method: 'POST',\n      body: JSON.stringify({ email }),\n      headers: {\n        'content-type': 'application/json',\n      },\n    });\n\n    if (!res.ok) {\n      throw new Error(`Failed to check user by email: ${email}`);\n    }\n\n    const data = AuthPreflightResponseSchema.safeParse(await res.json());\n    if (!data.success) {\n      throw createUnsupportedServerVersionError(\n        this.serverService.server.config$.value.version\n      );\n    }\n\n    return data.data;\n  }\n\n  async deleteAccount() {\n    const res = await this.gqlService.gql({\n      query: deleteAccountMutation,\n    });\n    return res.deleteAccount;\n  }","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/cloud/stores/auth.ts#L201-L237","documentation":"An HTTP-status guard in the auth store: checkUserByEmail POSTs to /api/auth/preflight and throws when the response is not ok. It fires when the preflight endpoint returns any non-2xx status (server error, rate limit, network-level failure); the interpolated email is the address being checked, not the cause — inspect the response status/network for the underlying reason.","triggerScenarios":"Thrown in checkUserByEmail when the POST to /api/auth/preflight returns a non-OK response, so the existence/registration state of the email cannot be determined.","commonSituations":"Seen during email sign-in when the preflight check fails due to network or server error. Retry; if persistent, verify the server is reachable.","solutions":["Verify the email address is correct and the server is reachable, then retry.","Check that the account service endpoint is available."],"exampleFix":null,"handlingStrategy":"try-catch","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"}