{"record":{"id":"9695824b7387dec8","repo":"BerriAI/litellm","slug":"team-not-found-in-db-and-user-not-proxy-admin-te","errorCode":null,"errorMessage":"Team not found in db, and user not proxy admin. Team id = {key_info.team_id}","messagePattern":"Team not found in db, and user not proxy admin\\. Team id = (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/management_endpoints/key_management_endpoints.py","lineNumber":4078,"sourceCode":"            check_db_only=True,\n        )\n        if litellm.key_generation_settings is not None and \"team_key_generation\" in litellm.key_generation_settings:\n            _team_key_generation = litellm.key_generation_settings[\"team_key_generation\"]\n        else:\n            _team_key_generation = TeamUIKeyGenerationConfig(\n                allowed_team_member_roles=[\"admin\", \"user\"],\n            )\n        # check if user is team admin\n        if team_table is not None:\n            return _team_key_operation_team_member_check(\n                assigned_user_id=user_api_key_dict.user_id,\n                team_table=team_table,\n                user_api_key_dict=user_api_key_dict,\n                team_key_generation=_team_key_generation,\n                route=KeyManagementRoutes.KEY_DELETE,\n            )\n        else:\n            raise HTTPException(\n                status_code=status.HTTP_404_NOT_FOUND,\n                detail={\"error\": f\"Team not found in db, and user not proxy admin. Team id = {key_info.team_id}\"},\n            )\n    return False\n\n\nasync def can_modify_verification_token(\n    key_info: LiteLLM_VerificationToken,\n    user_api_key_cache: UserApiKeyCache,\n    user_api_key_dict: UserAPIKeyAuth,\n    prisma_client: PrismaClient,\n) -> bool:\n    \"\"\"\n    Check if user has permission to modify (delete/regenerate) a verification token.\n\n    Rules:\n    - Proxy admin can modify any key\n    - Internal jobs service account can modify any key (for auto-rotation)","sourceCodeStart":4060,"sourceCodeEnd":4096,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/key_management_endpoints.py#L4060-L4096","documentation":"Error \"Team not found in db, and user not proxy admin. Team id = {key_info.team_id}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4078 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the key's team_id references an existing team via /team/list.","Authenticate as a proxy admin to access keys whose team is missing."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}