{"record":{"id":"b55547dd3c7bfb54","repo":"BerriAI/litellm","slug":"404","errorCode":"404","errorMessage":"Team not found, team_id={team_id}","messagePattern":"Team not found, team_id=(.+?)","errorType":"http","errorClass":"ProxyException","httpStatus":404,"severity":"error","filePath":"enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py","lineNumber":114,"sourceCode":"        team = await _team_table(prisma_client).find_unique(where={\"team_id\": team_id})\n\n    if team and team.admins:\n        return user_api_key_dict.user_id in team.admins\n\n    return False\n\n\nasync def _validate_team_exists(\n    team_id: str,\n    prisma_client: PrismaClient,\n) -> \"prisma_models.LiteLLM_TeamTable\":\n    \"\"\"Validate that a team exists. Returns the team row.\"\"\"\n    team = await _team_table(prisma_client).find_unique(\n        where={\"team_id\": team_id},\n    )\n\n    if team is None:\n        raise ProxyException(\n            message=f\"Team not found, team_id={team_id}\",\n            type=\"not_found\",\n            code=404,\n            param=\"team_id\",\n        )\n\n    return team\n\n\ndef _check_team_project_limits(\n    team_object: LiteLLM_TeamTable,\n    data: NewProjectRequest | UpdateProjectRequest,\n) -> None:\n    \"\"\"\n    Check that project limits respect its parent Team's limits.\n\n    Mirrors _check_org_team_limits() from team_endpoints.py.\n","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py#L96-L132","documentation":"_validate_team_exists is the first validation step of the project endpoints: it does find_unique on LiteLLM_TeamTable by team_id and raises ProxyException (type=not_found, code=404, param=team_id) when the row is absent, before any project mutation happens.","triggerScenarios":"POST /project/new, /project/update, /project/info or /project/delete with a team_id that does not exist — typo, deleted team, or wrong database/environment.","commonSituations":"Hardcoded team ids copied from another deployment; the team was deleted by an admin mid-workflow; scripts pointed at a fresh database.","solutions":["List teams via GET /team/list and copy the exact team_id","Create the team first via POST /team/new if it should exist","Confirm you are authenticated to the intended proxy/DB (staging vs prod)"],"exampleFix":"# before\ncurl -X POST http://0.0.0.0:4000/project/new -d '{\"team_id\": \"team-123\", \"project_alias\": \"p1\"}'\n\n# after: use a real team_id from GET /team/list\ncurl -X POST http://0.0.0.0:4000/project/new -d '{\"team_id\": \"<id-from-/team/list>\", \"project_alias\": \"p1\"}'","handlingStrategy":"validation","validationCode":"teams = await get(\"/team/list\")\nteam_ids = {t[\"team_id\"] for t in teams}\nif data[\"team_id\"] not in team_ids:\n    raise ValueError(f\"team {data['team_id']} does not exist; pick from {sorted(team_ids)}\")\nawait post(\"/project/new\", json=data)","typeGuard":null,"tryCatchPattern":"try:\n    await post(\"/project/new\", json=data)\nexcept HTTPStatusError as e:\n    if e.response.status_code == 404 and \"Team not found\" in e.response.text:\n        create_team_then_retry()  # or fix the id\n    raise","preventionTips":["Fetch team ids from /team/list at runtime instead of hardcoding","Create teams before projects in provisioning scripts"],"tags":["litellm","projects","teams","not-found","http-404"],"backgroundTag":"resource-not-found","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}