From 1a0b73403dbc4bf772f32f8b127a43e6564abe07 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Fri, 30 Oct 2026 00:35:39 -0700 Subject: [PATCH] refactor(proxy): parse a three-digit string status without recursing --- litellm/proxy/common_utils/openai_error_payload.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/common_utils/openai_error_payload.py b/litellm/proxy/common_utils/openai_error_payload.py index f839df772cd..a948c390375 100644 --- a/litellm/proxy/common_utils/openai_error_payload.py +++ b/litellm/proxy/common_utils/openai_error_payload.py @@ -65,8 +65,8 @@ def _http_error_status(value: object) -> int | None: return None case int() if value in _HTTP_ERROR_STATUSES: return value - case str() if len(value) == 3 and value.isascii() and value.isdigit(): - return _http_error_status(int(value)) + case str() if len(value) == 3 and value.isascii() and value.isdigit() and int(value) in _HTTP_ERROR_STATUSES: + return int(value) case _: return None