From b9a5ca6efbae468f09d6f7324812821a83136506 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 13 May 2026 14:15:29 -0700 Subject: [PATCH] fix STALE token with malformed value falling to ValueError instead of refresh When token_state is STALE but the token is None/non-string, downgrade token_state to INVALID so the blocking refresh path executes instead of skipping it and hitting the final ValueError. Co-Authored-By: Claude Opus 4.6 --- litellm/llms/vertex_ai/vertex_llm_base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.py index b029e9220f2..caf2022c1db 100644 --- a/litellm/llms/vertex_ai/vertex_llm_base.py +++ b/litellm/llms/vertex_ai/vertex_llm_base.py @@ -894,9 +894,9 @@ class VertexBase: raise ValueError("Could not resolve project_id") current_token = _credentials.token if current_token is None or not isinstance(current_token, str): - # Token is malformed despite STALE state — fall through - # to INVALID path which will block on a full refresh. - pass + # Token is malformed despite STALE state — downgrade to + # INVALID so the next block performs a blocking refresh. + token_state = TokenState.INVALID else: # Schedule a single background refresh — skip if one is # already in flight for this credential key.