BerriAI/litellm · error · Exception

Error comparing versions: {e}

Error message

Error comparing versions: {e}

What it means

Catch-all from the version comparison routine: after both versions were fetched, computing the field-by-field diff or building the PolicyVersionCompareResponse raised; the original exception is embedded.

Source

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

                "guardrails_remove",
                "condition",
                "pipeline",
            )
            field_diffs: Final[dict[str, dict[str, object]]] = {}
            for field in compare_fields:
                val_a = getattr(resp_a, field)
                val_b = getattr(resp_b, field)
                if val_a != val_b:
                    field_diffs[field] = {"version_a": val_a, "version_b": val_b}

            return PolicyVersionCompareResponse(
                version_a=resp_a,
                version_b=resp_b,
                field_diffs=field_diffs,
            )
        except Exception as e:
            verbose_proxy_logger.exception("Error comparing versions: %s", e)
            raise Exception(f"Error comparing versions: {e}")

    async def delete_all_versions(
        self,
        policy_name: str,
        prisma_client: "PrismaClient",
    ) -> Mapping[str, str]:
        """
        Delete all versions of a policy. Also removes from in-memory registry.

        Args:
            policy_name: Name of the policy
            prisma_client: The Prisma client instance

        Returns:
            Dict with "message" and optional "warning" if a config-defined policy took over.
        """
        try:
            await _policy_table(prisma_client).delete_many(where={"policy_name": policy_name})

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check the error detail; ensure both version IDs are valid and comparable, then retry.
Defensive patterns

Strategy: try-catch

When it happens

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