From fc4ad87a6cdb53eab97d76b228cb167dffbe8d75 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Sat, 31 Oct 2026 13:52:01 -0700 Subject: [PATCH] fix(router): read the context window fallbacks through the typed fallback list helper --- litellm/router_python_core.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/litellm/router_python_core.py b/litellm/router_python_core.py index 96954ba5f7c..a3f4d0ec67d 100644 --- a/litellm/router_python_core.py +++ b/litellm/router_python_core.py @@ -10524,7 +10524,13 @@ class PythonCore(DeprecatedRouterMembers): return False if self._stream_can_fall_back(model_group, kwargs): return True - configured: Final = kwargs.get("context_window_fallbacks", self._core_context_window_fallbacks) + configured: Final = _request_fallback_list( + kwargs, + "context_window_fallbacks", + cast( # cast-ok: list is invariant and the helper takes list[object] + "list[object] | None", self._core_context_window_fallbacks + ), + ) if not configured: return False try: