BerriAI/litellm · error · HTTPException
Only a proxy admin can delete a model whose team has been de
Error message
Only a proxy admin can delete a model whose team has been deleted.
What it means
Orphaned-team guard in the model auth checks: the model's model_info.team_id references a team that has been deleted from the DB. Callers that do not pass allow_missing_team are rejected — only a proxy admin may act on such orphaned models, preventing non-admins from exploiting dangling team references.
Source
Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:1511
model_params: Deployment,
user_api_key_dict: UserAPIKeyAuth,
prisma_client: PrismaClient,
premium_user: bool,
allow_missing_team: bool = False,
) -> Literal[True]:
## Check team model auth
if model_params.model_info is not None and model_params.model_info.team_id is not None:
team_obj_row: Final = await _repo_team_table(prisma_client).find_unique(
where={"team_id": model_params.model_info.team_id}
)
if team_obj_row is None:
# The team was deleted. Callers that opt in (e.g. model deletion) may
# act on the orphaned model, but only as a proxy admin -- without the
# team there is no team-admin membership left to verify.
if allow_missing_team:
if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN:
return True
raise HTTPException(
status_code=403,
detail={"error": "Only a proxy admin can delete a model whose team has been deleted."},
)
raise HTTPException(
status_code=400,
detail={"error": f"Team id={model_params.model_info.team_id} does not exist in db"},
)
team_obj: Final = LiteLLM_TeamTable.model_validate(team_obj_row.model_dump())
return ModelManagementAuthChecks.can_user_make_team_model_call(
team_id=model_params.model_info.team_id,
user_api_key_dict=user_api_key_dict,
team_obj=team_obj,
premium_user=premium_user,
)
## Check non-team model auth
elif user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN:
raise HTTPException(View on GitHub (pinned to 77b7c6c40c)
Solutions
- Use a PROXY_ADMIN API key to delete a model whose team has been deleted.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:1511 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/58dcaa5b4750b76d.
Report an issue: GitHub.