{"record":{"id":"0aa7b5c1510e92c4","repo":"BerriAI/litellm","slug":"user-user-id-caller-user-id-is-not-a-member-of-t","errorCode":null,"errorMessage":"User user_id={caller_user_id} is not a member of team_id={team_id}.","messagePattern":"User user_id=(.+?) is not a member of team_id=(.+?)\\.","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/management_endpoints/team_endpoints.py","lineNumber":4303,"sourceCode":"        user_api_key_cache=user_api_key_cache,\n    )\n\n    caller_user_email: Final = user_api_key_dict.user_email\n    member_role: str | None = None\n    for m in team_table.members_with_roles:\n        # Match by user_id when present, else fall back to email — members\n        # added by email may have user_id=None on the stored entry.\n        if (m.user_id is not None and m.user_id == caller_user_id) or (\n            m.user_email is not None and caller_user_email is not None and m.user_email == caller_user_email\n        ):\n            member_role = m.role\n            break\n\n    if member_role is None:\n        # Caller is not a member of this team. Even proxy admins get 404 here —\n        # they can use /team/info to view all members; \"me\" only resolves for\n        # actual members of the team.\n        raise HTTPException(\n            status_code=status.HTTP_404_NOT_FOUND,\n            detail={\"error\": f\"User user_id={caller_user_id} is not a member of team_id={team_id}.\"},\n        )\n\n    membership: Final = await get_team_membership(\n        user_id=caller_user_id,\n        team_id=team_id,\n        prisma_client=prisma_client,\n        user_api_key_cache=user_api_key_cache,\n    )\n\n    user_row: Final = await get_user_object(\n        user_id=caller_user_id,\n        prisma_client=prisma_client,\n        user_api_key_cache=user_api_key_cache,\n        user_id_upsert=False,\n    )\n    user_email: Final = getattr(user_row, \"user_email\", None) if user_row is not None else None","sourceCodeStart":4285,"sourceCodeEnd":4321,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/team_endpoints.py#L4285-L4321","documentation":"Error \"User user_id={caller_user_id} is not a member of team_id={team_id}.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/team_endpoints.py:4303 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the user to the team first, or call with a key for a user who is a member of 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-14T00:17:10.932Z"}