From 19e098f7d21e03274bbfa78e5e1c8bd05f5626ef Mon Sep 17 00:00:00 2001 From: dajiaohuang Date: Fri, 4 Sep 2026 14:16:19 +0800 Subject: [PATCH] fix: avoid rebinding infinity error headers --- litellm/llms/infinity/common_utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/litellm/llms/infinity/common_utils.py b/litellm/llms/infinity/common_utils.py index c3503c1f6c0..30a5f1006f7 100644 --- a/litellm/llms/infinity/common_utils.py +++ b/litellm/llms/infinity/common_utils.py @@ -5,8 +5,7 @@ from litellm.llms.base_llm.chat.transformation import BaseLLMException class InfinityError(BaseLLMException): def __init__(self, status_code: int, message: str, headers: dict | httpx.Headers | None = None): - if headers is None: - headers = {} + resolved_headers = {} if headers is None else headers self.status_code = status_code self.message = message self.request = httpx.Request(method="POST", url="https://github.com/michaelfeil/infinity") @@ -16,5 +15,5 @@ class InfinityError(BaseLLMException): message=message, request=self.request, response=self.response, - headers=headers, + headers=resolved_headers, ) # Call the base class constructor with the parameters it needs