BerriAI/litellm · error · Exception
Only draft versions can be published. Current status: '{curr
Error message
Only draft versions can be published. Current status: '{current}'. What it means
Status-transition guard in the policy registry: publishing (setting published_at) is only allowed from the draft status, but the row's current version_status is something else (already published or production).
Source
Thrown at litellm/proxy/policy_engine/policy_registry.py:895
Returns:
PolicyDBResponse for the updated version
"""
try:
if new_status not in ("published", "production"):
raise Exception(f"Invalid status '{new_status}'. Use 'published' or 'production'.")
row: Final = await _policy_table(prisma_client).find_unique(where={"policy_id": policy_id})
if row is None:
raise Exception(f"Policy with ID {policy_id} not found")
current: Final = getattr(row, "version_status", "production")
policy_name: Final = row.policy_name
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":View on GitHub (pinned to 77b7c6c40c)
Solutions
- Only draft versions can be published; create a new draft from the current version and publish that.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/policy_engine/policy_registry.py:895 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/ec67ce8985a24f64.
Report an issue: GitHub.