From 2b4a1c4f46858a5a2a4e730b142c5023bf567a1e Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Thu, 23 Apr 2026 17:00:10 -0700 Subject: [PATCH] fix(guardrail_endpoints): use correct PK field in rollback delete and log rollback failure --- litellm/proxy/guardrails/guardrail_endpoints.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_endpoints.py b/litellm/proxy/guardrails/guardrail_endpoints.py index 799bb8a4c02..deb5963ff06 100644 --- a/litellm/proxy/guardrails/guardrail_endpoints.py +++ b/litellm/proxy/guardrails/guardrail_endpoints.py @@ -347,10 +347,12 @@ async def create_guardrail( if prisma_client is not None: try: await prisma_client.db.litellm_guardrailstable.delete( - where={"id": guardrail_id} + where={"guardrail_id": guardrail_id} + ) + except Exception as rollback_err: + verbose_proxy_logger.warning( + f"Rollback failed for guardrail '{guardrail_id}': {rollback_err}" ) - except Exception: - pass raise HTTPException( status_code=400, detail=f"Guardrail configuration error: {init_error}",