{"record":{"id":"343b474366ec3f50","repo":"BerriAI/litellm","slug":"only-draft-or-published-versions-can-be-promoted-t","errorCode":null,"errorMessage":"Only draft or published versions can be promoted to production. Current: '{current}'.","messagePattern":"Only draft or published versions can be promoted to production\\. Current: '(.+?)'\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/policy_engine/policy_registry.py","lineNumber":909,"sourceCode":"            now: Final = datetime.now(timezone.utc)\n\n            if new_status == \"published\":\n                if current != \"draft\":\n                    raise Exception(f\"Only draft versions can be published. Current status: '{current}'.\")\n                updated = await _policy_table(prisma_client).update(\n                    where={\"policy_id\": policy_id},\n                    data={\n                        \"version_status\": \"published\",\n                        \"published_at\": now,\n                        \"updated_at\": now,\n                        \"updated_by\": updated_by,\n                    },\n                )\n                return _row_to_policy_db_response(updated)\n\n            # new_status == \"production\"\n            if current not in (\"draft\", \"published\"):\n                raise Exception(\n                    f\"Only draft or published versions can be promoted to production. Current: '{current}'.\"\n                )\n            # Plan: \"draft -> production\" NOT allowed\n            if current == \"draft\":\n                raise Exception(\"Cannot promote draft directly to production. Publish the version first.\")\n\n            # Demote current production to published\n            await _policy_table(prisma_client).update_many(\n                where={\n                    \"policy_name\": policy_name,\n                    \"version_status\": \"production\",\n                },\n                data={\n                    \"version_status\": \"published\",\n                    \"updated_at\": now,\n                    \"updated_by\": updated_by,\n                },\n            )","sourceCodeStart":891,"sourceCodeEnd":927,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/policy_engine/policy_registry.py#L891-L927","documentation":"Raised when promoting to 'production' but the current version_status is neither 'draft' nor 'published' (i.e. an already-demoted or invalid state); production promotion requires a publishable version.","triggerScenarios":"Thrown at litellm/proxy/policy_engine/policy_registry.py:909 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Promote only draft or published versions to production; check the version's current status first."],"exampleFix":null,"handlingStrategy":"validation","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"}