BerriAI/litellm · error · Exception

Only draft or published versions can be promoted to producti

Error message

Only draft or published versions can be promoted to production. Current: '{current}'.

What it means

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.

Source

Thrown at litellm/proxy/policy_engine/policy_registry.py:909

            now: Final = datetime.now(timezone.utc)

            if new_status == "published":
                if current != "draft":
                    raise Exception(f"Only draft versions can be published. Current status: '{current}'.")
                updated = await _policy_table(prisma_client).update(
                    where={"policy_id": policy_id},
                    data={
                        "version_status": "published",
                        "published_at": now,
                        "updated_at": now,
                        "updated_by": updated_by,
                    },
                )
                return _row_to_policy_db_response(updated)

            # new_status == "production"
            if current not in ("draft", "published"):
                raise Exception(
                    f"Only draft or published versions can be promoted to production. Current: '{current}'."
                )
            # Plan: "draft -> production" NOT allowed
            if current == "draft":
                raise Exception("Cannot promote draft directly to production. Publish the version first.")

            # Demote current production to published
            await _policy_table(prisma_client).update_many(
                where={
                    "policy_name": policy_name,
                    "version_status": "production",
                },
                data={
                    "version_status": "published",
                    "updated_at": now,
                    "updated_by": updated_by,
                },
            )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Promote only draft or published versions to production; check the version's current status first.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/policy_engine/policy_registry.py:909 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/343b474366ec3f50. Report an issue: GitHub.