From dc08db9e33a4c772e72b945d0c279ca5d54b1195 Mon Sep 17 00:00:00 2001 From: tombii Date: Tue, 17 Feb 2026 21:06:43 +0100 Subject: [PATCH] fix: Add 404 to status_code exemption list to make NotFoundError retry logic reachable The previous fix was incomplete - NotFoundError (status_code=404) was being caught and raised at line 5283 before reaching the new NotFoundError handling logic at line 5285. Added 404 to the status_code exemption tuple at line 5282, similar to how 401 and 403 are handled, to allow the NotFoundError block to execute and check for multiple deployments. Thanks to @greptile-apps for catching this in the code review. --- litellm/router.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/router.py b/litellm/router.py index aad482b5d66..a34463a695b 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -5278,8 +5278,8 @@ class Router: status_code = getattr(error, "status_code", None) if status_code is not None and not litellm._should_retry(status_code): - # 401/403 are special cases - allow retry if multiple deployments exist (handled below) - if status_code not in (401, 403): + # 401/403/404 are special cases - allow retry if multiple deployments exist (handled below) + if status_code not in (401, 403, 404): raise error if isinstance(error, litellm.NotFoundError):