BerriAI/litellm · error · ValueError

Either user id or user email must be provided

Error message

Either user id or user email must be provided

What it means

Pydantic model_validator on UpdateUserRequest (mirroring the team-member validator) rejecting a user update that identifies no target: both user_id and user_email are None. Because non-None field defaults on this model overwrite existing values, applying an unidentified update would be both a no-op and dangerous, so validation fails before any DB write.

Source

Thrown at litellm/proxy/_types.py:1709

            LitellmUserRoles.INTERNAL_USER,
            LitellmUserRoles.INTERNAL_USER_VIEW_ONLY,
        ]
        | None
    ) = None
    max_budget: float | None = None


class UpdateUserRequest(UpdateUserRequestNoUserIDorEmail):
    # Note: the defaults of all Params here MUST BE NONE
    # else they will get overwritten
    user_id: str | None = None
    user_email: str | None = None

    @model_validator(mode="before")
    @classmethod
    def check_user_info(cls, values):
        if values.get("user_id") is None and values.get("user_email") is None:
            raise ValueError("Either user id or user email must be provided")
        return values


class DeleteUserRequest(LiteLLMPydanticObjectBase):
    user_ids: list[str]  # required


AllowedModelRegion = Literal["eu", "us"]


class BudgetNewRequest(LiteLLMPydanticObjectBase):
    budget_id: str | None = Field(default=None, description="The unique budget id.")
    max_budget: float | None = Field(
        default=None,
        description="Requests will fail if this budget (in USD) is exceeded.",
    )
    soft_budget: float | None = Field(
        default=None,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide user_id or user_email in the request.

Example fix

user_id='user-123'
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/_types.py:1709 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/02fcee5044a8f2dd. Report an issue: GitHub.