From 5881fc4a0e3d0a1df8fe9746aa9cd0b817705d45 Mon Sep 17 00:00:00 2001 From: Yujong Lee Date: Fri, 6 Nov 2026 16:09:24 +0900 Subject: [PATCH] fix(router): read health states without a catch-all, DualCache already swallows read errors --- litellm/router_utils/health_state_cache.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/litellm/router_utils/health_state_cache.py b/litellm/router_utils/health_state_cache.py index ea9833ccda5..30547f8002c 100644 --- a/litellm/router_utils/health_state_cache.py +++ b/litellm/router_utils/health_state_cache.py @@ -108,20 +108,12 @@ class DeploymentHealthCache: @with_service_target(HEALTH_CHECKS_TARGET) async def async_get_states(self) -> object: """Every deployment's raw state, as the router core's health filter reads it; a failed read is None.""" - try: - return await self.cache.async_get_cache(key=self.CACHE_KEY) # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType] # DualCache's reads are untyped - except Exception as e: - verbose_logger.debug("DeploymentHealthCache::async_get_states - Exception: %s", str(e)) - return None + return await self.cache.async_get_cache(key=self.CACHE_KEY) # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType] # DualCache's reads are untyped @with_service_target(HEALTH_CHECKS_TARGET) def get_states(self) -> object: """``async_get_states`` for a sync call.""" - try: - return self.cache.get_cache(key=self.CACHE_KEY) # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType] # DualCache's reads are untyped - except Exception as e: - verbose_logger.debug("DeploymentHealthCache::get_states - Exception: %s", str(e)) - return None + return self.cache.get_cache(key=self.CACHE_KEY) # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType] # DualCache's reads are untyped @with_service_target(HEALTH_CHECKS_TARGET) async def async_get_unhealthy_deployment_ids(self, parent_otel_span: Span | None = None) -> set[str]: