BerriAI/litellm · error · HTTPException

Team not found in db, and user not proxy admin. Team id = {k

Error message

Team not found in db, and user not proxy admin. Team id = {key_info.team_id}

What it means

Error "Team not found in db, and user not proxy admin. Team id = {key_info.team_id}" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4078

            check_db_only=True,
        )
        if litellm.key_generation_settings is not None and "team_key_generation" in litellm.key_generation_settings:
            _team_key_generation = litellm.key_generation_settings["team_key_generation"]
        else:
            _team_key_generation = TeamUIKeyGenerationConfig(
                allowed_team_member_roles=["admin", "user"],
            )
        # check if user is team admin
        if team_table is not None:
            return _team_key_operation_team_member_check(
                assigned_user_id=user_api_key_dict.user_id,
                team_table=team_table,
                user_api_key_dict=user_api_key_dict,
                team_key_generation=_team_key_generation,
                route=KeyManagementRoutes.KEY_DELETE,
            )
        else:
            raise HTTPException(
                status_code=status.HTTP_404_NOT_FOUND,
                detail={"error": f"Team not found in db, and user not proxy admin. Team id = {key_info.team_id}"},
            )
    return False


async def can_modify_verification_token(
    key_info: LiteLLM_VerificationToken,
    user_api_key_cache: UserApiKeyCache,
    user_api_key_dict: UserAPIKeyAuth,
    prisma_client: PrismaClient,
) -> bool:
    """
    Check if user has permission to modify (delete/regenerate) a verification token.

    Rules:
    - Proxy admin can modify any key
    - Internal jobs service account can modify any key (for auto-rotation)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the key's team_id references an existing team via /team/list.
  2. Authenticate as a proxy admin to access keys whose team is missing.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4078 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/9695824b7387dec8. Report an issue: GitHub.