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.
This commit is contained in:
tombii 2026-02-17 21:06:43 +01:00
parent f1b90cbf2b
commit dc08db9e33

View file

@ -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):