From e3cf4d8f0067cf3bd6af2ed3a3f32a9f2308e552 Mon Sep 17 00:00:00 2001 From: Vedant-2-6 Date: Mon, 31 Aug 2026 18:38:19 +0530 Subject: [PATCH 1/2] fix: use None default for InfinityError headers to avoid mutable default argument Using a mutable default argument = {} causes all InfinityError instances raised without explicit headers to share the same dict object. This matches the convention already used by BaseLLMException, OpenAIError, and AnthropicError. Fixes #38909 --- litellm/llms/infinity/common_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/llms/infinity/common_utils.py b/litellm/llms/infinity/common_utils.py index e23fe4a0d37..657bbd8bfd3 100644 --- a/litellm/llms/infinity/common_utils.py +++ b/litellm/llms/infinity/common_utils.py @@ -4,7 +4,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 = {}): + def __init__(self, status_code: int, message: str, headers: dict | httpx.Headers | None = None): self.status_code = status_code self.message = message self.request = httpx.Request(method="POST", url="https://github.com/michaelfeil/infinity") @@ -15,4 +15,4 @@ class InfinityError(BaseLLMException): request=self.request, response=self.response, headers=headers, - ) # Call the base class constructor with the parameters it needs + ) # Call the base class constructor with the parameters it needs \ No newline at end of file From f2ff24d01b3d8c632f04f6b9feca63ae2b43b948 Mon Sep 17 00:00:00 2001 From: Vedant-2-6 Date: Mon, 31 Aug 2026 19:05:32 +0530 Subject: [PATCH 2/2] style: apply ruff format (add trailing newline) --- litellm/llms/infinity/common_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/infinity/common_utils.py b/litellm/llms/infinity/common_utils.py index 657bbd8bfd3..3122664b579 100644 --- a/litellm/llms/infinity/common_utils.py +++ b/litellm/llms/infinity/common_utils.py @@ -15,4 +15,4 @@ class InfinityError(BaseLLMException): request=self.request, response=self.response, headers=headers, - ) # Call the base class constructor with the parameters it needs \ No newline at end of file + ) # Call the base class constructor with the parameters it needs