{"record":{"id":"d7ffef3dfbee3116","repo":"BerriAI/litellm","slug":"you-are-not-authorized-to-regenerate-this-key","errorCode":null,"errorMessage":"You are not authorized to regenerate this key","messagePattern":"You are not authorized to regenerate this key","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/management_endpoints/key_management_endpoints.py","lineNumber":4995,"sourceCode":"            )\n\n        # check if user has permission to regenerate key\n        await TeamMemberPermissionChecks.can_team_member_execute_key_management_endpoint(\n            user_api_key_dict=user_api_key_dict,\n            route=KeyManagementRoutes.KEY_REGENERATE,\n            prisma_client=prisma_client,\n            existing_key_row=_key_in_db,\n            user_api_key_cache=user_api_key_cache,\n        )\n\n        # check if user has ownership permission to regenerate key\n        if not await can_modify_verification_token(\n            key_info=_key_in_db,\n            user_api_key_cache=user_api_key_cache,\n            user_api_key_dict=user_api_key_dict,\n            prisma_client=prisma_client,\n        ):\n            raise HTTPException(\n                status_code=status.HTTP_403_FORBIDDEN,\n                detail={\"error\": \"You are not authorized to regenerate this key\"},\n            )\n\n        if data is not None and (data.access_group_ids or data.object_permission is not None):\n            regenerate_team_table: LiteLLM_TeamTableCachedObj | None = None\n            if _key_in_db.team_id is not None:\n                regenerate_team_table = await get_team_object(\n                    team_id=_key_in_db.team_id,\n                    prisma_client=prisma_client,\n                    user_api_key_cache=user_api_key_cache,\n                    check_db_only=True,\n                )\n            _regen_is_proxy_admin: Final = user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value\n            TeamMemberPermissionChecks.enforce_member_can_assign_access_groups(\n                user_api_key_dict=user_api_key_dict,\n                team_table=regenerate_team_table,\n                access_group_ids=data.access_group_ids,","sourceCodeStart":4977,"sourceCodeEnd":5013,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/key_management_endpoints.py#L4977-L5013","documentation":"Error \"You are not authorized to regenerate this key\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4995 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Authenticate as the key's owner, a team admin of the key's team, or a proxy admin.","Ask a proxy admin to regenerate the key for you."],"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"}