{"record":{"id":"f31a8a3ce5f0b48f","repo":"BerriAI/litellm","slug":"either-user-id-or-user-email-needs-to-be-passed-in","errorCode":null,"errorMessage":"Either user_id or user_email needs to be passed in","messagePattern":"Either user_id or user_email needs to be passed in","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/team_endpoints.py","lineNumber":3216,"sourceCode":"\n    -H 'Content-Type: application/json' \\\n\n    -d '{\n        \"team_id\": \"45e3e396-ee08-4a61-a88e-16b3ce7e0849\",\n        \"user_id\": \"krrish247652@berri.ai\"\n    }'\n    ```\n    \"\"\"\n    from litellm.proxy.proxy_server import prisma_client\n\n    if prisma_client is None:\n        raise HTTPException(status_code=500, detail={\"error\": \"No db connected\"})\n\n    if data.team_id is None:\n        raise HTTPException(status_code=400, detail={\"error\": \"No team id passed in\"})\n\n    if data.user_id is None and data.user_email is None:\n        raise HTTPException(\n            status_code=400,\n            detail={\"error\": \"Either user_id or user_email needs to be passed in\"},\n        )\n\n    _existing_team_row: Final = await _team_db(prisma_client).find_unique(where={\"team_id\": data.team_id})\n\n    if _existing_team_row is None:\n        raise HTTPException(\n            status_code=400,\n            detail={\"error\": f\"Team id={data.team_id} does not exist in db\"},\n        )\n    existing_team_row: Final = LiteLLM_TeamTable.model_validate(_existing_team_row.model_dump())\n\n    ## CHECK IF USER IS PROXY ADMIN OR TEAM ADMIN OR ORG ADMIN\n\n    if (\n        user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN.value\n        and not _is_user_team_admin(user_api_key_dict=user_api_key_dict, team_obj=existing_team_row)","sourceCodeStart":3198,"sourceCodeEnd":3234,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/team_endpoints.py#L3198-L3234","documentation":"Error \"Either user_id or user_email needs to be passed in\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/team_endpoints.py:3216 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass either user_id or user_email in the request body."],"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"}