From c5202edfd0b0a61b5ff7a3a0f88a3ed2b332fe57 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Tue, 16 Jun 2026 17:46:49 +0800 Subject: [PATCH] fix: return failed status dict instead of raising Exception when wildcard model provider is unknown in ahealth_check_wildcard_models --- litellm/litellm_core_utils/health_check_helpers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/litellm/litellm_core_utils/health_check_helpers.py b/litellm/litellm_core_utils/health_check_helpers.py index 9e972f1910..fd97af1d69 100644 --- a/litellm/litellm_core_utils/health_check_helpers.py +++ b/litellm/litellm_core_utils/health_check_helpers.py @@ -31,9 +31,10 @@ class HealthCheckHelpers: custom_llm_provider=custom_llm_provider, n=3 ) if len(cheapest_models) == 0: - raise Exception( - f"Unable to health check wildcard model for provider {custom_llm_provider}. Add a model on your config.yaml or contribute here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json" - ) + return { + "status": "failed", + "reason": f"Unable to health check wildcard model for provider {custom_llm_provider}. Add a model on your config.yaml or contribute here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json" + } if len(cheapest_models) > 1: fallback_models = cheapest_models[ 1: