{"record":{"id":"c0dc4ae3224bf9e7","repo":"BerriAI/litellm","slug":"user-does-not-belong-to-team-team-id-available","errorCode":null,"errorMessage":"User does not belong to team: {team_id}. Available teams: {user_teams}","messagePattern":"User does not belong to team: (.+?)\\. Available teams: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/management_endpoints/ui_sso.py","lineNumber":2478,"sourceCode":"                    team_details_response = user_team_details\n                elif user_teams:\n                    team_details_response = [{\"team_id\": t, \"team_alias\": None} for t in user_teams]\n                poll_response: dict[str, object] = {\n                    \"status\": \"ready\",\n                    \"user_id\": user_id,\n                    \"teams\": user_teams,\n                    \"team_details\": team_details_response,\n                    \"requires_team_selection\": True,\n                }\n                attribution_metadata = _cli_poll_attribution_metadata_from_session(session_data)\n                if attribution_metadata:\n                    poll_response[\"attribution_metadata\"] = attribution_metadata\n                return poll_response\n\n            # Validate team_id if provided\n            if team_id is not None:\n                if team_id not in user_teams:\n                    raise HTTPException(\n                        status_code=403,\n                        detail=f\"User does not belong to team: {team_id}. Available teams: {user_teams}\",\n                    )\n            else:\n                # If no team_id provided and user has 0 or 1 team, use first team (or None)\n                team_id = user_teams[0] if len(user_teams) > 0 else None\n\n            selected_team: Final = _selected_cli_sso_team_detail(\n                team_details=user_team_details,\n                team_id=team_id,\n            )\n            if selected_team is None:\n                raise HTTPException(\n                    status_code=500,\n                    detail=f\"Could not resolve the model grants for team: {team_id}. Please run `lite login` again\",\n                )\n\n            user_info: Final = LiteLLM_UserTable(","sourceCodeStart":2460,"sourceCodeEnd":2496,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/ui_sso.py#L2460-L2496","documentation":"Error \"User does not belong to team: {team_id}. Available teams: {user_teams}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/ui_sso.py:2478 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pick one of the available teams listed in the error, or ask an admin to add the user to the team."],"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"}