BerriAI/litellm · error · ValueError

Must specify either 'users' for individual updates or 'all_u

Error message

Must specify either 'users' for individual updates or 'all_users=True' with 'user_updates' for bulk updates

What it means

Cross-field validator on the bulk user-update request: neither a 'users' list nor the combination all_users=True with user_updates was provided, so the update has no target. Exactly one targeting approach must be chosen.

Source

Thrown at litellm/types/proxy/management_endpoints/internal_user_endpoints.py:45

    users: list[UpdateUserRequest] | None = None  # List of specific user update requests
    all_users: bool | None = False  # Flag to update all users
    user_updates: UpdateUserRequestNoUserIDorEmail | None = None  # Updates to apply to all users when all_users=True

    @field_validator("users", "all_users", "user_updates")
    @classmethod
    def validate_request(cls, v, info):
        # Get all field values for validation
        values: Final = info.data if hasattr(info, "data") else {}

        # After all fields are set, validate the combination
        if info.field_name == "user_updates":  # This is the last field, do validation here
            users: Final = values.get("users")
            all_users: Final = values.get("all_users", False)
            user_updates: Final = v

            # Must specify either users list OR all_users with user_updates
            if not users and not (all_users and user_updates):
                raise ValueError(
                    "Must specify either 'users' for individual updates or 'all_users=True' with 'user_updates' for bulk updates"
                )

            # Cannot specify both users list and all_users
            if users and all_users:
                raise ValueError("Cannot specify both 'users' and 'all_users=True'. Choose one approach.")

        return v


class UserUpdateResult(BaseModel):
    """Result of a single user update operation"""

    user_id: str | None = None
    user_email: str | None = None
    success: bool
    error: str | None = None
    updated_user: dict[str, Any] | None = None

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Either pass 'users' for individual updates, or set all_users=True together with 'user_updates' for bulk updates.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/types/proxy/management_endpoints/internal_user_endpoints.py:45 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/0e3573e4bdc2861b. Report an issue: GitHub.