BerriAI/litellm · error · ValueError

Cannot specify both 'users' and 'all_users=True'. Choose one

Error message

Cannot specify both 'users' and 'all_users=True'. Choose one approach.

What it means

Cross-field validator on the bulk user-update request: both an explicit 'users' list and all_users=True were supplied at once. These are mutually exclusive targeting modes; remove one before retrying.

Source

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

    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


class BulkUpdateUserResponse(BaseModel):
    """Response for bulk user update operations"""

    results: list[UserUpdateResult]

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Choose one approach: 'users' list OR all_users=True with user_updates, not both.
Defensive patterns

Strategy: validation

When it happens

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