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}",