toeverything/AFFiNE · error · Error
Failed to login
Error message
Failed to login
What it means
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.
Source
Thrown at packages/frontend/admin/src/modules/auth/index.tsx:37
const login = useCallback(
(e: FormEvent) => {
e.preventDefault();
e.stopPropagation();
if (!emailRef.current || !passwordRef.current) return;
affineFetch('/api/auth/sign-in', {
method: 'POST',
body: JSON.stringify({
email: emailRef.current?.value,
password: passwordRef.current?.value,
}),
headers: {
'Content-Type': 'application/json',
},
})
.then(async response => {
if (!response.ok) {
const data = await response.json();
throw new Error(data.message || 'Failed to login');
}
return response.json();
})
.then(() =>
affineFetch('/graphql', {
method: 'POST',
body: JSON.stringify({
operationName: getUserFeaturesQuery.op,
query: getUserFeaturesQuery.query,
variables: {},
}),
headers: {
'Content-Type': 'application/json',
},
})
)
.then(res => res.json())
.then(View on GitHub (pinned to b4c8548c09)
Solutions
- Check admin credentials and server availability, then retry.
- Verify the admin account exists.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: 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.
Common situations: 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.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/9fa80efb77a20ad3.
Report an issue: GitHub.