{"record":{"id":"b420ff505b1b19e3","repo":"BerriAI/litellm","slug":"user-does-not-belong-to-team-team-id-call-us","errorCode":null,"errorMessage":"User does not belong to Team= {team_id}. Call `/user/info` to see user's teams","messagePattern":"User does not belong to Team= (.+?)\\. Call `/user/info` to see user's teams","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/management_endpoints/team_endpoints.py","lineNumber":5754,"sourceCode":"            user_id_upsert=False,\n            user_api_key_cache=user_api_key_cache,\n            parent_otel_span=user_api_key_dict.parent_otel_span,\n            proxy_logging_obj=proxy_logging_obj,\n            check_db_only=True,\n        )\n        if user_info is None:\n            raise HTTPException(\n                status_code=404,\n                detail={\"error\": f\"User= {user_api_key_dict.user_id} not found\"},\n            )\n\n        if team_ids_list is None:\n            team_ids_list = user_info.teams\n        else:\n            # check if all team_ids are in user_info.teams\n            for team_id in team_ids_list:\n                if team_id not in user_info.teams:\n                    raise HTTPException(\n                        status_code=404,\n                        detail={\n                            \"error\": f\"User does not belong to Team= {team_id}. Call `/user/info` to see user's teams\"\n                        },\n                    )\n\n    ## Fetch team aliases and check team admin status\n    where_condition: Final[_TeamIdInFilter] = {}\n    if team_ids_list:\n        where_condition[\"team_id\"] = {\"in\": list(team_ids_list)}\n    team_aliases: Final = await _team_db(prisma_client).find_many(where=where_condition)\n    team_alias_metadata: Final = {t.team_id: {\"team_alias\": _as_object(t.team_alias)} for t in team_aliases}\n\n    # Check if user is team admin or has /team/daily/activity permission\n    # If not, filter by user's API keys.\n    #\n    # Earlier this loop used `any-team admin -> set has_full_team_view=True\n    # for the entire request`, so an admin of one team that requested","sourceCodeStart":5736,"sourceCodeEnd":5772,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/team_endpoints.py#L5736-L5772","documentation":"Error \"User does not belong to Team= {team_id}. Call `/user/info` to see user's teams\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/team_endpoints.py:5754 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call /user/info to see the user's teams, and use a team_id the user actually belongs to."],"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"}