From e70b1bbfadaa25903b5155c3334931deec7c6d45 Mon Sep 17 00:00:00 2001 From: "rohan.w.charles" Date: Wed, 14 Jan 2026 16:04:36 +0530 Subject: [PATCH] fix: add handling for user-disabled mid-stream fallbacks --- litellm/router.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litellm/router.py b/litellm/router.py index 638df49ac05..9e12fbe9433 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -1380,6 +1380,11 @@ class Router: Catches errors for fallbacks using the router's fallback system """ + if initial_kwargs.get("disable_fallbacks", False): + verbose_router_logger.info("Mid stream fallback disabled by user, re-raising original error") + if e.original_exception is not None: + raise e.original_exception + raise e from litellm.exceptions import MidStreamFallbackError class FallbackStreamWrapper(CustomStreamWrapper):