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:63

    statement = (
        select(User).order_by(col(User.created_at).desc()).offset(skip).limit(limit)
    )
    users = session.exec(statement).all()

    users_public = [UserPublic.model_validate(user) for user in users]
    return UsersPublic(data=users_public, count=count)


@router.post(
    "/", dependencies=[Depends(get_current_active_superuser)], response_model=UserPublic
)
def create_user(*, session: SessionDep, user_in: UserCreate) -> Any:
    """
    Create new user.
    """
    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 = crud.create_user(session=session, user_create=user_in)
    if settings.emails_enabled and user_in.email:
        email_data = generate_new_account_email(
            email_to=user_in.email, username=user_in.email, password=user_in.password
        )
        send_email(
            email_to=user_in.email,
            subject=email_data.subject,
            html_content=email_data.html_content,
        )
    return user


@router.patch("/me", response_model=UserPublic)

View on GitHub (pinned to 8063fe54f1)

When it happens

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