From d2d6e6f22a850ac9b156ca1aab31bfe7775633da Mon Sep 17 00:00:00 2001 From: Joseph Barker Date: Tue, 7 Apr 2026 13:39:32 -0700 Subject: [PATCH] Add fallback message when blocking service returns empty explanation Prevents whitespace-only violation message when the tool blocking service blocks tools but returns an empty content field. Co-Authored-By: Claude Opus 4.6 (1M context) --- litellm/integrations/rubrik.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/integrations/rubrik.py b/litellm/integrations/rubrik.py index ae525f6b1ee..e901ec5fbb7 100644 --- a/litellm/integrations/rubrik.py +++ b/litellm/integrations/rubrik.py @@ -453,7 +453,8 @@ class RubrikLogger(CustomGuardrail, CustomBatchLogger): if len(allowed_tools) == len(all_tool_calls): return None + explanation = blocking_explanation or "Tool call blocked by policy." return BlockedToolsResult( allowed_tools=allowed_tools, - explanation=f"\n\n{blocking_explanation}", + explanation=f"\n\n{explanation}", )