{"record":{"id":"7e40e707f2fb6449","repo":"BerriAI/litellm","slug":"f-user-user-id-is-not-within-your-admin-scope-o","errorCode":null,"errorMessage":"f\"User {user_id} is not within your admin scope. Only PROXY_ADMIN may delete users outside your administered organizations.\"","messagePattern":"f\"User (.+?) is not within your admin scope\\. Only PROXY_ADMIN may delete users outside your administered organizations\\.\"","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/management_endpoints/internal_user_endpoints.py","lineNumber":2290,"sourceCode":"            target_org_ids_by_user.setdefault(m.user_id, set()).add(m.organization_id)\n\n    # check that all teams passed exist\n    for user_id in data.user_ids:\n        user_row = await UserRepository(prisma_client).table.find_unique(where={\"user_id\": user_id})\n\n        if user_row is None:\n            raise HTTPException(\n                status_code=404,\n                detail={\"error\": f\"User not found, passed user_id={user_id}\"},\n            )\n\n        if not caller_is_proxy_admin:\n            target_org_ids = target_org_ids_by_user.get(user_id, set())\n            # Org-admin may only delete users whose entire org membership is\n            # within their admin scope. A target with ANY org outside the\n            # caller's scope (or no org at all) requires PROXY_ADMIN.\n            if not target_org_ids or not target_org_ids.issubset(caller_admin_org_ids):\n                raise HTTPException(\n                    status_code=403,\n                    detail={\n                        \"error\": (\n                            f\"User {user_id} is not within your admin scope. \"\n                            \"Only PROXY_ADMIN may delete users outside your \"\n                            \"administered organizations.\"\n                        )\n                    },\n                )\n\n        # Enterprise Feature - Audit Logging. Enable with litellm.store_audit_logs = True\n        # we do this after the first for loop, since first for loop is for validation. we only want this inserted after validation passes\n        if litellm.store_audit_logs is True:\n            # make an audit log for each team deleted\n            _user_row = user_row.json(exclude_none=True)\n\n            asyncio.create_task(\n                create_audit_log_for_update(","sourceCodeStart":2272,"sourceCodeEnd":2308,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/internal_user_endpoints.py#L2272-L2308","documentation":"Error \"f\"User {user_id} is not within your admin scope. Only PROXY_ADMIN may delete users outside your administered organizations.\"\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/internal_user_endpoints.py:2290 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ask a PROXY_ADMIN to delete this user, since they are outside your administered organizations.","Delete only users who belong to organizations you administer."],"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-14T05:17:10.506Z"}