{"record":{"id":"c519370499ebcb16","repo":"BerriAI/litellm","slug":"only-proxy-admins-can-update-all-users-at-once","errorCode":null,"errorMessage":"Only proxy admins can update all users at once.","messagePattern":"Only proxy admins can update all users at once\\.","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/management_endpoints/internal_user_endpoints.py","lineNumber":1756,"sourceCode":"        )\n\n    # Only proxy admins can modify user_role in bulk updates\n    _bulk_role = getattr(data.user_updates, \"user_role\", None) if data.user_updates else None\n    if _bulk_role is None and data.users:\n        _bulk_role = next((u.user_role for u in data.users if u.user_role is not None), None)\n    if _bulk_role is not None and user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN.value:\n        raise HTTPException(\n            status_code=403,\n            detail=\"Only proxy admins can modify user roles.\",\n        )\n\n    # Determine the list of users to update\n    users_to_update: list[UpdateUserRequest] | list[UpdateUserRequestNoUserIDorEmail] = []\n\n    if data.all_users and data.user_updates:\n        # Only proxy admins can update all users at once\n        if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN.value:\n            raise HTTPException(\n                status_code=403,\n                detail=\"Only proxy admins can update all users at once.\",\n            )\n        # Optimized path for updating all users directly in database\n        all_users_in_db: Final = await _user_table(prisma_client).find_many(order={\"created_at\": \"desc\"})\n\n        if not all_users_in_db:\n            raise HTTPException(\n                status_code=400,\n                detail={\"error\": \"No users found to update\"},\n            )\n\n        # Limit batch size to prevent overwhelming the system\n        MAX_BATCH_SIZE = 500  # Increased limit for all-users operations\n        if len(all_users_in_db) > MAX_BATCH_SIZE:\n            raise HTTPException(\n                status_code=400,\n                detail={","sourceCodeStart":1738,"sourceCodeEnd":1774,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/internal_user_endpoints.py#L1738-L1774","documentation":"Error \"Only proxy admins can update all users at once.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/internal_user_endpoints.py:1756 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call this endpoint with a proxy admin API key (user_role=PROXY_ADMIN).","If you need to update many users, ask a proxy admin to run the bulk update, or update users individually with your own permissions."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}