From 6c999c558cedee37be1443a781aead8ad6d08b83 Mon Sep 17 00:00:00 2001 From: LyraCS Date: Tue, 8 Sep 2026 15:19:12 +0700 Subject: [PATCH] fix(vertex): format messages, handle undecodable credential files --- litellm/llms/vertex_ai/vertex_llm_base.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.py index dc88c98e9c9..17f108b217e 100644 --- a/litellm/llms/vertex_ai/vertex_llm_base.py +++ b/litellm/llms/vertex_ai/vertex_llm_base.py @@ -150,8 +150,7 @@ class VertexBase: json_obj = json.load(f) except FileNotFoundError as e: raise Exception( - "Unable to load vertex credentials from file path: " - f"{credentials}. File not found. ({e})" + f"Unable to load vertex credentials from file path: {credentials}. File not found. ({e})" ) from e except PermissionError as e: raise Exception( @@ -163,7 +162,7 @@ class VertexBase: "Unable to load vertex credentials from file path: " f"{credentials}. Unable to read file. ({e})" ) from e - except json.JSONDecodeError as e: + except (json.JSONDecodeError, UnicodeDecodeError) as e: raise Exception( "Unable to load vertex credentials from file path: " f"{credentials}. Ensure the JSON is valid "