BerriAI/litellm · error · HTTPException
f"Maximum {MAX_BATCH_SIZE} users can be updated at once. Fou
Error message
f"Maximum {MAX_BATCH_SIZE} users can be updated at once. Found {len(all_users_in_db)} users." What it means
Error "f"Maximum {MAX_BATCH_SIZE} users can be updated at once. Found {len(all_users_in_db)} users."" thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/management_endpoints/internal_user_endpoints.py:1772
# Only proxy admins can update all users at once
if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN.value:
raise HTTPException(
status_code=403,
detail="Only proxy admins can update all users at once.",
)
# Optimized path for updating all users directly in database
all_users_in_db: Final = await _user_table(prisma_client).find_many(order={"created_at": "desc"})
if not all_users_in_db:
raise HTTPException(
status_code=400,
detail={"error": "No users found to update"},
)
# Limit batch size to prevent overwhelming the system
MAX_BATCH_SIZE = 500 # Increased limit for all-users operations
if len(all_users_in_db) > MAX_BATCH_SIZE:
raise HTTPException(
status_code=400,
detail={
"error": f"Maximum {MAX_BATCH_SIZE} users can be updated at once. Found {len(all_users_in_db)} users."
},
)
# Apply update transformations (reuse existing logic)
data_json: Final[dict] = data.user_updates.model_dump(exclude_unset=True)
non_default_values: Final = _update_internal_user_params(data_json=data_json, data=data.user_updates)
# Remove user identification fields since we're updating by user_id
non_default_values.pop("user_id", None)
non_default_values.pop("user_email", None)
successful_updates = 0
failed_updates: Final = 0
results: Final[list[UserUpdateResult]] = []
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Split the update into batches of at most MAX_BATCH_SIZE users per request.
- For very large installations, update users in groups filtered by team or organization instead of all at once.
When it happens
Trigger: Thrown at litellm/proxy/management_endpoints/internal_user_endpoints.py:1772 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/373975ac06b03e31.
Report an issue: GitHub.