BerriAI/litellm · error · Exception

Error getting versions: {e}

Error message

Error getting versions: {e}

What it means

Catch-all from the policy version listing routine: the find_many on the policy table filtered by policy_name (ordered by version_number) or conversion of rows failed; the original DB error text is embedded.

Source

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

            prisma_client: The Prisma client instance

        Returns:
            PolicyVersionListResponse with policy_name and list of versions
        """
        try:
            rows: Final = await _policy_table(prisma_client).find_many(
                where={"policy_name": policy_name},
                order={"version_number": "desc"},
            )
            versions: Final = [_row_to_policy_db_response(r) for r in rows]
            return PolicyVersionListResponse(
                policy_name=policy_name,
                versions=versions,
                total_count=len(versions),
            )
        except Exception as e:
            verbose_proxy_logger.exception("Error getting versions: %s", e)
            raise Exception(f"Error getting versions: {e}")

    async def create_new_version(
        self,
        policy_name: str,
        prisma_client: "PrismaClient",
        source_policy_id: str | None = None,
        created_by: str | None = None,
    ) -> PolicyDBResponse:
        """
        Create a new draft version of a policy. Copies all fields from the source.
        Source is current production if source_policy_id is None.

        Args:
            policy_name: Name of the policy
            prisma_client: The Prisma client instance
            source_policy_id: Policy ID to clone from; if None, use current production
            created_by: User who created the version

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check DB connectivity and logs; verify the policy exists, then retry.
Defensive patterns

Strategy: try-catch

When it happens

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