BerriAI/litellm · error · Exception
Only draft versions can be updated. This policy has status '
Error message
Only draft versions can be updated. This policy has status '{version_status}'. What it means
Versioning guard in the policy registry: only draft versions are editable, but the policy being updated has the shown version_status (e.g. 'published' or 'production'). Edits must go through a new draft created from the version.
Source
Thrown at litellm/proxy/policy_engine/policy_registry.py:458
Args:
policy_id: The ID of the policy to update
policy_request: The policy update request
prisma_client: The Prisma client instance
updated_by: User who updated the policy
Returns:
PolicyDBResponse with the updated policy
Raises:
Exception: If policy is not in draft status (only drafts are editable).
"""
try:
existing: Final = await _policy_table(prisma_client).find_unique(where={"policy_id": policy_id})
if existing is None:
raise Exception(f"Policy with ID {policy_id} not found")
version_status: Final = getattr(existing, "version_status", "production")
if version_status != "draft":
raise Exception(f"Only draft versions can be updated. This policy has status '{version_status}'.")
# Build update data - only include fields that are set
update_data: Final[dict[str, object]] = {
"updated_at": datetime.now(timezone.utc),
"updated_by": updated_by,
}
if policy_request.policy_name is not None:
update_data["policy_name"] = policy_request.policy_name
if policy_request.inherit is not None:
update_data["inherit"] = policy_request.inherit
if policy_request.description is not None:
update_data["description"] = policy_request.description
if policy_request.guardrails_add is not None:
update_data["guardrails_add"] = policy_request.guardrails_add
if policy_request.guardrails_remove is not None:
update_data["guardrails_remove"] = policy_request.guardrails_remove
if policy_request.condition is not None:View on GitHub (pinned to 77b7c6c40c)
Solutions
- Create a new draft version to make changes; only draft versions are editable.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/policy_engine/policy_registry.py:458 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/d73b1ccad1de0b84.
Report an issue: GitHub.