BerriAI/litellm · error · HTTPException

Either user_id or user_email needs to be passed in

Error message

Either user_id or user_email needs to be passed in

What it means

Error "Either user_id or user_email needs to be passed in" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/team_endpoints.py:3216

    -H 'Content-Type: application/json' \

    -d '{
        "team_id": "45e3e396-ee08-4a61-a88e-16b3ce7e0849",
        "user_id": "krrish247652@berri.ai"
    }'
    ```
    """
    from litellm.proxy.proxy_server import prisma_client

    if prisma_client is None:
        raise HTTPException(status_code=500, detail={"error": "No db connected"})

    if data.team_id is None:
        raise HTTPException(status_code=400, detail={"error": "No team id passed in"})

    if data.user_id is None and data.user_email is None:
        raise HTTPException(
            status_code=400,
            detail={"error": "Either user_id or user_email needs to be passed in"},
        )

    _existing_team_row: Final = await _team_db(prisma_client).find_unique(where={"team_id": data.team_id})

    if _existing_team_row is None:
        raise HTTPException(
            status_code=400,
            detail={"error": f"Team id={data.team_id} does not exist in db"},
        )
    existing_team_row: Final = LiteLLM_TeamTable.model_validate(_existing_team_row.model_dump())

    ## CHECK IF USER IS PROXY ADMIN OR TEAM ADMIN OR ORG ADMIN

    if (
        user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN.value
        and not _is_user_team_admin(user_api_key_dict=user_api_key_dict, team_obj=existing_team_row)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass either user_id or user_email in the request body.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/team_endpoints.py:3216 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/f31a8a3ce5f0b48f. Report an issue: GitHub.