{"record":{"id":"9bd39c7ab55954e8","repo":"BerriAI/litellm","slug":"regenerating-virtual-keys-is-an-enterprise-feature","errorCode":null,"errorMessage":"Regenerating Virtual Keys is an Enterprise feature, {CommonProxyErrors.not_premium_user.value}","messagePattern":"Regenerating Virtual Keys is an Enterprise feature, (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/key_management_endpoints.py","lineNumber":4922,"sourceCode":"                allow_safe_presets=True,\n            )\n\n        # Premium-gate bypass for master-key rotation must verify the\n        # caller actually holds the master key, not just that the request\n        # body has a ``new_master_key`` field. A presence-only check let\n        # any non-premium caller skip the enterprise gate by sending any\n        # value in that field.\n        regenerate_target_key: Final = data.key if data and data.key else key\n        is_master_key_regeneration: Final = (\n            data is not None\n            and data.new_master_key is not None\n            and _is_master_key(api_key=regenerate_target_key, _master_key=master_key)\n        )\n\n        if (\n            premium_user is not True and not is_master_key_regeneration\n        ):  # allow master key regeneration for non-premium users\n            raise ValueError(\n                f\"Regenerating Virtual Keys is an Enterprise feature, {CommonProxyErrors.not_premium_user.value}\"\n            )\n\n        # Check if key exists, raise exception if key is not in the DB\n        key = data.key if data and data.key else key\n        if not key:\n            raise HTTPException(status_code=400, detail={\"error\": \"No key passed in.\"})\n        ### 1. Create New copy that is duplicate of existing key\n        ######################################################################\n\n        # create duplicate of existing key\n        # set token = new token generated\n        # insert new token in DB\n\n        # create hash of token\n        if prisma_client is None:\n            raise HTTPException(\n                status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,","sourceCodeStart":4904,"sourceCodeEnd":4940,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/key_management_endpoints.py#L4904-L4940","documentation":"Error \"Regenerating Virtual Keys is an Enterprise feature, {CommonProxyErrors.not_premium_user.value}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4922 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set LITELLM_LICENSE in the proxy environment with a valid enterprise license.","Create a new key instead of regenerating if enterprise features are unavailable."],"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"}