fastapi/full-stack-fastapi-template · error · HTTPException
Super users are not allowed to delete themselves
Error message
Super users are not allowed to delete themselves
What it means
Error "Super users are not allowed to delete themselves" thrown in fastapi/full-stack-fastapi-template.
Source
Thrown at backend/app/api/routes/users.py:138
session.commit()
return Message(message="Password updated successfully")
@router.get("/me", response_model=UserPublic)
def read_user_me(current_user: CurrentUser) -> Any:
"""
Get current user.
"""
return current_user
@router.delete("/me", response_model=Message)
def delete_user_me(session: SessionDep, current_user: CurrentUser) -> Any:
"""
Delete own user.
"""
if current_user.is_superuser:
raise HTTPException(
status_code=403, detail="Super users are not allowed to delete themselves"
)
session.delete(current_user)
session.commit()
return Message(message="User deleted successfully")
@router.post("/signup", response_model=UserPublic)
def register_user(session: SessionDep, user_in: UserRegister) -> Any:
"""
Create new user without the need to be logged in.
"""
user = crud.get_user_by_email(session=session, email=user_in.email)
if user:
raise HTTPException(
status_code=400,
detail="The user with this email already exists in the system",
)View on GitHub (pinned to 8063fe54f1)
When it happens
Trigger: Thrown at backend/app/api/routes/users.py:138 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of fastapi/full-stack-fastapi-template@8063fe54f1 (2026-08-26).
Data as JSON: /api/errors/eabe4c73c65fb7f6.
Report an issue: GitHub.