BerriAI/litellm · error · HTTPException

User={user_api_key_dict.user_id} not authorized to access th

Error message

User={user_api_key_dict.user_id} not authorized to access this team={team_table.team_id}

What it means

Error "User={user_api_key_dict.user_id} not authorized to access this team={team_table.team_id}" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/team_endpoints.py:4049

                },
            )
        else:
            raise HTTPException(
                status_code=403,
                detail={
                    "error": f"API key not authorized to access this team={team_table.team_id}. No user_id or team_id associated with this key."
                },
            )

    # Check direct team membership
    if user_api_key_dict.user_id in [m.user_id for m in team_table.members_with_roles]:
        return

    # Check if user is an org admin for the team's organization
    if await _is_user_org_admin_for_team(user_api_key_dict=user_api_key_dict, team_obj=team_table):
        return

    raise HTTPException(
        status_code=403,
        detail={"error": f"User={user_api_key_dict.user_id} not authorized to access this team={team_table.team_id}"},
    )


async def _add_team_member_budget_table(
    team_member_budget_id: str,
    prisma_client: PrismaClient,
    team_info_response_object: TeamInfoResponseObjectTeamTable,
) -> TeamInfoResponseObjectTeamTable:
    try:
        team_budget: Final = await _budget_db(prisma_client).find_unique(where={"budget_id": team_member_budget_id})
        return team_info_response_object.model_copy(update={"team_member_budget_table": team_budget})
    except Exception:
        verbose_proxy_logger.info(
            "Team member budget table not found, passed team_member_budget_id=%s", team_member_budget_id
        )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a key whose user is a member or admin of the target team, or a proxy admin key.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/team_endpoints.py:4049 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/24ffb6bfd9e4aca3. Report an issue: GitHub.