fastapi/full-stack-fastapi-template · error · HTTPException

The user with this email already exists in the system

Error message

The user with this email already exists in the system

What it means

Error "The user with this email already exists in the system" thrown in fastapi/full-stack-fastapi-template.

Source

Thrown at backend/app/api/routes/users.py:153

    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",
        )
    user_create = UserCreate.model_validate(user_in)
    user = crud.create_user(session=session, user_create=user_create)
    return user


@router.get("/{user_id}", response_model=UserPublic)
def read_user_by_id(
    user_id: uuid.UUID, session: SessionDep, current_user: CurrentUser
) -> Any:
    """
    Get a specific user by id.
    """
    user = session.get(User, user_id)
    if user == current_user:
        return user

View on GitHub (pinned to 8063fe54f1)

When it happens

Trigger: Thrown at backend/app/api/routes/users.py:153 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/5b5916467ea26814. Report an issue: GitHub.