BerriAI/litellm · error · HTTPException

Unique user not found for user_email={user_email}. Potential

Error message

Unique user not found for user_email={user_email}. Potential duplicate OR non-existent user_email in LiteLLM_UserTable. Use 'user_id' instead.

What it means

find_member_if_email resolves a user by user_email via a unique lookup on LiteLLM_UserTable; Prisma raises when the email is absent OR duplicated, so the helper converts that into a ProxyException telling the caller to disambiguate with user_id. The at-fault input is a user_email that is not a unique key in the user table.

Source

Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:1284

        raise ProxyException(
            message="Authentication Error, " + str(e),
            type=ProxyErrorTypes.auth_error,
            param=getattr(e, "param", "None"),
            code=status.HTTP_500_INTERNAL_SERVER_ERROR,
        )


async def find_member_if_email(user_email: str, prisma_client: PrismaClient) -> LiteLLM_UserTable:
    """
    Find a member if the user_email is in LiteLLM_UserTable
    """

    try:
        existing_user_email_row: Final[BaseModel] = await UserRepository(prisma_client).table.find_unique(
            where={"user_email": user_email}
        )
    except Exception:
        raise HTTPException(
            status_code=400,
            detail={
                "error": f"Unique user not found for user_email={user_email}. Potential duplicate OR non-existent user_email in LiteLLM_UserTable. Use 'user_id' instead."
            },
        )
    existing_user_email_row_pydantic: Final = LiteLLM_UserTable.model_validate(existing_user_email_row.model_dump())
    return existing_user_email_row_pydantic


@router.patch(
    "/organization/member_update",
    tags=["organization management"],
    dependencies=[Depends(user_api_key_auth)],
    response_model=LiteLLM_OrganizationMembershipTable,
)
@management_endpoint_wrapper
async def organization_member_update(
    data: OrganizationMemberUpdateRequest,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use user_id instead of user_email; the email is duplicated or non-existent in LiteLLM_UserTable.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:1284 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/d8fc4fbf57d88e85. Report an issue: GitHub.