From 1a4989dd090ccac31f3d683bb2904d583edd1012 Mon Sep 17 00:00:00 2001 From: Yiyang Liu <37043548+ianliuy@users.noreply.github.com> Date: Thu, 16 Apr 2026 14:08:00 -0700 Subject: [PATCH] fix: add None guard for num_retries comparison in router (fixes #25889) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Yiyang Liu <37043548+ianliuy@users.noreply.github.com> --- litellm/router.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/router.py b/litellm/router.py index 9185e437a3a..edaf4dec979 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -5768,7 +5768,7 @@ class Router: _metadata["max_retries"] = num_retries ## LOGGING - if num_retries > 0: + if num_retries is not None and num_retries > 0: kwargs = self.log_retry(kwargs=kwargs, e=original_exception) else: raise