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

The user with this id does not exist in the system

Error message

The user with this id does not exist in the system

What it means

Error "The user with this id does not exist in the system" thrown in fastapi/full-stack-fastapi-template.

Source

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

@router.patch(
    "/{user_id}",
    dependencies=[Depends(get_current_active_superuser)],
    response_model=UserPublic,
)
def update_user(
    *,
    session: SessionDep,
    user_id: uuid.UUID,
    user_in: UserUpdate,
) -> Any:
    """
    Update a user.
    """

    db_user = session.get(User, user_id)
    if not db_user:
        raise HTTPException(
            status_code=404,
            detail="The user with this id does not exist in the system",
        )
    if user_in.email:
        existing_user = crud.get_user_by_email(session=session, email=user_in.email)
        if existing_user and existing_user.id != user_id:
            raise HTTPException(
                status_code=409, detail="User with this email already exists"
            )

    db_user = crud.update_user(session=session, db_user=db_user, user_in=user_in)
    return db_user


@router.delete("/{user_id}", dependencies=[Depends(get_current_active_superuser)])
def delete_user(
    session: SessionDep, current_user: CurrentUser, user_id: uuid.UUID
) -> Message:

View on GitHub (pinned to 8063fe54f1)

When it happens

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