Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(responses): satisfy streaming regression checks

zoroyihan7dc7895c1eacf
diff --git a/litellm/proxy/common_utils/responses_stream_errors.py b/litellm/proxy/common_utils/responses_stream_errors.py
index 356e948a2df..706b4c298d7 100644
--- a/litellm/proxy/common_utils/responses_stream_errors.py
+++ b/litellm/proxy/common_utils/responses_stream_errors.py
@@ -48,9 +48,10 @@ class _FailureDetails(BaseModel):
def _original_failure(exception: Exception) -> Exception:
- if isinstance(exception, MidStreamFallbackError) and exception.original_exception is not None:
- return _original_failure(exception.original_exception)
- return exception
+ current = exception # rebind-ok: the recursion gate requires iterative wrapper traversal
+ while isinstance(current, MidStreamFallbackError) and current.original_exception is not None:
+ current = current.original_exception
+ return current
def _response_error_code(details: _FailureDetails) -> str:
diff --git a/tests/proxy_unit_tests/test_response_polling_pre_call_checks.py b/tests/proxy_unit_tests/test_response_polling_pre_call_checks.py
index 459834d0fd2..3fabdcefe5a 100644
--- a/tests/proxy_unit_tests/test_response_polling_pre_call_checks.py
+++ b/tests/proxy_unit_tests/test_response_polling_pre_call_checks.py
@@ -130,7 +130,6 @@ class TestPollingEndpointPreCallGuard:
"litellm.proxy.proxy_server.proxy_config": MagicMock(),
"litellm.proxy.proxy_server.proxy_logging_obj": AsyncMock(),
"litellm.proxy.proxy_server.redis_usage_cache": AsyncMock(),
- "litellm.proxy.proxy_server.select_data_generator": None,
"litellm.proxy.proxy_server.user_api_base": None,
"litellm.proxy.proxy_server.user_max_tokens": None,
"litellm.proxy.proxy_server.user_model": None,