From 7fd02e7d56de919276fd1e9d985e429ee7b67559 Mon Sep 17 00:00:00 2001 From: Ashton Sidhu Date: Thu, 19 Mar 2026 10:24:00 -0400 Subject: [PATCH] Fix potential header issue --- .../guardrails/guardrail_hooks/hiddenlayer/hiddenlayer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/hiddenlayer/hiddenlayer.py b/litellm/proxy/guardrails/guardrail_hooks/hiddenlayer/hiddenlayer.py index a8001f70334..15a945f0d1d 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/hiddenlayer/hiddenlayer.py +++ b/litellm/proxy/guardrails/guardrail_hooks/hiddenlayer/hiddenlayer.py @@ -348,7 +348,10 @@ class HiddenlayerGuardrailV2(CustomGuardrail): # put our roundtrip id in the header to the model so we get it on the way back from the model if "hl-roundtrip-id" not in headers: - request_data["proxy_server_request"]["headers"]["hl-roundtrip-id"] = str(uuid4()) + proxy_req = request_data.get("proxy_server_request") + if proxy_req is not None and "headers" in proxy_req: + proxy_req["headers"]["hl-roundtrip-id"] = str(uuid4()) + headers["hl-roundtrip-id"] = proxy_req["headers"]["hl-roundtrip-id"] hl_headers = {h.lower():v for h,v in headers.items() if h.lower().startswith("hl-")}