BerriAI/litellm · error · HTTPException

Only draft versions can be updated. Publish or create a new

Error message

Only draft versions can be updated. Publish or create a new version to change published/production.

What it means

Raised in the policy update endpoint when the existing version's version_status is not 'draft': only draft versions are mutable, so published/production versions must be cloned into a new draft to change.

Source

Thrown at litellm/proxy/policy_engine/policy_endpoints.py:456

            "guardrails_add": ["pii_masking", "toxicity_filter"]
        }'
    ```
    """
    from litellm.proxy.proxy_server import prisma_client

    if prisma_client is None:
        raise HTTPException(status_code=500, detail="Database not connected")

    try:
        # Check if policy exists and is draft (only drafts can be updated)
        existing: Final = await get_policy_registry().get_policy_by_id_from_db(
            policy_id=policy_id,
            prisma_client=prisma_client,
        )
        if existing is None:
            raise HTTPException(status_code=404, detail=f"Policy with ID {policy_id} not found")
        if getattr(existing, "version_status", "production") != "draft":
            raise HTTPException(
                status_code=400,
                detail="Only draft versions can be updated. Publish or create a new version to change published/production.",
            )

        updated_by: Final = user_api_key_dict.user_id
        result: Final = await get_policy_registry().update_policy_in_db(
            policy_id=policy_id,
            policy_request=request,
            prisma_client=prisma_client,
            updated_by=updated_by,
        )
        return result
    except HTTPException:
        raise
    except Exception as e:
        verbose_proxy_logger.exception("Error updating policy: %s", e)
        raise HTTPException(status_code=500, detail=str(e))

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Create a new draft version of the policy and apply changes there; published/production versions are immutable.
  2. Promote the new draft through publish → production to roll out the change.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/policy_engine/policy_endpoints.py:456 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/ee463ae698bd94be. Report an issue: GitHub.