HKUDS/DeepTutor · error · HTTPException
Self-registration is closed. Ask an administrator to create…
Error message
Self-registration is closed. Ask an administrator to create your account.
What it means
HTTP 403 raised by POST /register when the user store already has its first admin (or PocketBase mode is on and is_first_user() is false). Registration is bootstrap-only: it exists solely to create the first admin, after which accounts are admin-provisioned.
Solutions
- Ask an administrator to create the account via POST /api/v1/auth/users
- In PocketBase mode, provision users in the PocketBase admin UI
- Hide/disable the signup page once an admin exists
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at deeptutor/api/routers/auth.py:515 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/e8d44c41b197e65f.
Report an issue: GitHub.
Appendix: source
Thrown at deeptutor/api/routers/auth.py:515
Bootstrap-only registration.
Public endpoint that creates the *first* admin account when the user store
is empty. Once an admin exists, this endpoint is closed; further accounts
must be created by an admin via ``POST /api/v1/auth/users``.
Only available when AUTH_ENABLED=true.
"""
if not AUTH_ENABLED:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail="Auth is disabled — registration is not available.",
)
if POCKETBASE_ENABLED:
# PocketBase deployments are documented as single-user. Keep registration
# closed and require admins to provision users in the PocketBase admin UI.
if not is_first_user():
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail="Self-registration is closed. Ask an administrator to create your account.",
)
result = register_pb(username=body.username, email=body.username, password=body.password)
if not result:
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail="Registration failed — username or email may already be taken.",
)
logger.info(f"First user registered via PocketBase: '{body.username}'")
return {
"ok": True,
"user_id": result.get("id", ""),
"username": body.username,
"role": "user",
"is_first_user": True,
"is_admin": False,
}View on GitHub (pinned to 3e82f13042)