BerriAI/litellm · error · Exception

No production version found for policy '{policy_name}'

Error message

No production version found for policy '{policy_name}'

What it means

Version-creation guard in the policy registry: no source_policy_id was given, so the current production version of the named policy was to be cloned, but no production version exists for that policy_name.

Source

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

        try:
            if source_policy_id is not None:
                source = await _policy_version_source_table(prisma_client).find_unique(
                    where={"policy_id": source_policy_id}
                )
                if source is None:
                    raise Exception(f"Source policy {source_policy_id} not found")
                if source.policy_name != policy_name:
                    raise Exception(f"Source policy name '{source.policy_name}' does not match '{policy_name}'")
            else:
                # Find current production version for this policy_name
                prod: Final = await _policy_version_source_table(prisma_client).find_first(
                    where={
                        "policy_name": policy_name,
                        "version_status": "production",
                    }
                )
                if prod is None:
                    raise Exception(f"No production version found for policy '{policy_name}'")
                source = prod

            # Next version number
            latest: Final = await _policy_version_source_table(prisma_client).find_first(
                where={"policy_name": policy_name},
                order={"version_number": "desc"},
            )
            next_num: Final = (latest.version_number + 1) if latest else 1

            now: Final = datetime.now(timezone.utc)
            # Set is_latest=False on all existing versions for this policy_name
            await _policy_table(prisma_client).update_many(
                where={"policy_name": policy_name},
                data={"is_latest": False},
            )

            data: Final[dict[str, object]] = {
                "policy_name": policy_name,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Publish a version and promote it to production before referencing the policy's production version.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at litellm/proxy/policy_engine/policy_registry.py:809 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/22e55f9f146ae3bc. Report an issue: GitHub.