HKUDS/DeepTutor · error · HTTPException
Incorrect email or password
Error message
Incorrect email or password
What it means
HTTP 401 raised by the POST /login handler in deeptutor/api/routers/auth.py:447 in PocketBase mode when PocketBase fails to authenticate the supplied email/password pair. Deliberately generic so it does not reveal whether the account exists; a JWT cookie is only set when pb_result yields a valid payload.
Solutions
- Verify the email/password with the PocketBase admin
- Check the user exists in the PocketBase deployment
- Allow the user to retry; rate-limit repeated failures
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at deeptutor/api/routers/auth.py:447 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/4c71e393d2d6b4f0.
Report an issue: GitHub.
Appendix: source
Thrown at deeptutor/api/routers/auth.py:447
username=payload.username if payload else None,
role=payload.role if payload else None,
is_admin=payload.role == "admin" if payload else False,
avatar=avatar,
)
@router.post("/login")
async def login(body: LoginRequest, response: Response) -> dict:
"""Validate credentials and set a JWT cookie."""
if not AUTH_ENABLED:
return {"ok": True, "message": "Auth is disabled — no login required."}
if POCKETBASE_ENABLED:
# PocketBase mode: email = username field for backwards-compat with the
# existing LoginRequest schema; users can pass their email as "username".
pb_result = authenticate_pb(body.username, body.password)
if not pb_result:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Incorrect email or password",
)
payload, pb_token = pb_result
response.set_cookie(value=pb_token, max_age=_COOKIE_MAX_AGE, **_cookie_attrs())
logger.info(f"User '{payload.username}' logged in via PocketBase (role={payload.role!r})")
return {
"ok": True,
"user_id": payload.user_id,
"username": payload.username,
"role": payload.role,
"is_admin": payload.role == "admin",
}
# Standard JWT + bcrypt mode
result = authenticate(body.username, body.password)
if not result:
raise HTTPException(View on GitHub (pinned to 3e82f13042)