BerriAI/litellm · error · HTTPException

Multiple users with this email found in db. Please use 'user

Error message

Multiple users with this email found in db. Please use 'user_id' instead.

What it means

HTTPException raised while adding a team member by email: the lookup on LiteLLM_UserTable found multiple rows with the same user_email (email is not unique in the schema), so the member to add is ambiguous. The caller must disambiguate by passing user_id instead of email.

Source

Thrown at litellm/proxy/management_helpers/utils.py:333

        ## user email is not unique acc. to prisma schema -> future improvement
        ### for now: check if it exists in db, if not - insert it
        existing_user_row: Final[list | None] = await prisma_client.get_data(
            key_val={"user_email": new_member.user_email},
            table_name="user",
            query_type="find_all",
        )
        if existing_user_row is None or (isinstance(existing_user_row, list) and len(existing_user_row) == 0):
            new_user_defaults["teams"] = [team_id]
            _returned_user = await prisma_client.insert_data(data=new_user_defaults, table_name="user")

            if _returned_user is not None:
                returned_user = LiteLLM_UserTable.model_validate(_returned_user.model_dump())
        elif len(existing_user_row) == 1:
            user_info: Final = existing_user_row[0]
            await _append_team_id_if_absent(prisma_client, user_info.user_id, team_id)
            returned_user = LiteLLM_UserTable.model_validate(user_info.model_dump())
        elif len(existing_user_row) > 1:
            raise HTTPException(
                status_code=400,
                detail={"error": "Multiple users with this email found in db. Please use 'user_id' instead."},
            )

    _budget_id: Final = await _resolve_member_budget_id(
        prisma_client=prisma_client,
        user_api_key_dict=user_api_key_dict,
        litellm_proxy_admin_name=litellm_proxy_admin_name,
        max_budget_in_team=max_budget_in_team,
        allowed_models=allowed_models,
        budget_duration=budget_duration,
        default_team_budget_id=default_team_budget_id,
    )

    if _budget_id and returned_user is not None and returned_user.user_id is not None:
        _returned_team_membership: Final = await TeamMembershipRepository(prisma_client).table.create(
            data={
                "team_id": team_id,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use user_id instead of email to disambiguate between the multiple matching users.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_helpers/utils.py:333 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/93937d7decc01f2f. Report an issue: GitHub.