BerriAI/litellm · error · Exception

Cannot promote draft directly to production. Publish the ver

Error message

Cannot promote draft directly to production. Publish the version first.

What it means

Policy version state-machine guard: an attempt was made to move a draft version directly to 'production'. The allowed path is draft -> published -> production, so the caller must publish the version first; raised before any status update is written.

Source

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

                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,
                },
            )

            # Promote this version to production
            updated = await _policy_table(prisma_client).update(
                where={"policy_id": policy_id},
                data={

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Publish the draft version first, then promote it to production.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/policy_engine/policy_registry.py:914 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/107134110ecd5913. Report an issue: GitHub.