{"record":{"id":"9fa80efb77a20ad3","repo":"toeverything/AFFiNE","slug":"failed-to-login","errorCode":null,"errorMessage":"Failed to login","messagePattern":"Failed to login","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/admin/src/modules/auth/index.tsx","lineNumber":37,"sourceCode":"  const login = useCallback(\n    (e: FormEvent) => {\n      e.preventDefault();\n      e.stopPropagation();\n      if (!emailRef.current || !passwordRef.current) return;\n      affineFetch('/api/auth/sign-in', {\n        method: 'POST',\n        body: JSON.stringify({\n          email: emailRef.current?.value,\n          password: passwordRef.current?.value,\n        }),\n        headers: {\n          'Content-Type': 'application/json',\n        },\n      })\n        .then(async response => {\n          if (!response.ok) {\n            const data = await response.json();\n            throw new Error(data.message || 'Failed to login');\n          }\n          return response.json();\n        })\n        .then(() =>\n          affineFetch('/graphql', {\n            method: 'POST',\n            body: JSON.stringify({\n              operationName: getUserFeaturesQuery.op,\n              query: getUserFeaturesQuery.query,\n              variables: {},\n            }),\n            headers: {\n              'Content-Type': 'application/json',\n            },\n          })\n        )\n        .then(res => res.json())\n        .then(","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/admin/src/modules/auth/index.tsx#L19-L55","documentation":"Admin console login handler: thrown when the /api/auth/sign-in response is not ok; it reads the server's error JSON and rethrows its message (falling back to 'Failed to login') so the React error boundary/state shows a login failure.","triggerScenarios":"Thrown when the admin panel login POST returns a non-OK response and the response body carries no message field, so a generic login failure is reported.","commonSituations":"An admin enters wrong credentials or the server rejects the login request without details. Verify email and password and that the AFFiNE server is reachable.","solutions":["Check admin credentials and server availability, then retry.","Verify the admin account exists."],"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-14T00:17:10.932Z"}