Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(team_endpoints.py): consistently return 404 if team not found in DB

Krrish Dholakia0e0925fccf42
diff --git a/litellm/proxy/management_endpoints/team_endpoints.py b/litellm/proxy/management_endpoints/team_endpoints.py
index 1994e27ecf5..f5bcc6ba11c 100644
--- a/litellm/proxy/management_endpoints/team_endpoints.py
+++ b/litellm/proxy/management_endpoints/team_endpoints.py
@@ -470,7 +470,7 @@ async def update_team(
if existing_team_row is None:
raise HTTPException(
- status_code=400,
+ status_code=404,
detail={"error": f"Team not found, passed team_id={data.team_id}"},
)
@@ -1137,14 +1137,16 @@ async def delete_team(
team_rows: List[LiteLLM_TeamTable] = []
for team_id in data.team_ids:
try:
- team_row_base: BaseModel = (
+ team_row_base: Optional[BaseModel] = (
await prisma_client.db.litellm_teamtable.find_unique(
where={"team_id": team_id}
)
)
+ if team_row_base is None:
+ raise Exception
except Exception:
raise HTTPException(
- status_code=400,
+ status_code=404,
detail={"error": f"Team not found, passed team_id={team_id}"},
)
team_row_pydantic = LiteLLM_TeamTable(**team_row_base.model_dump())