From 9a6366e90cd37fb39b2ffa97c193e15416155360 Mon Sep 17 00:00:00 2001 From: samearth17 Date: Mon, 10 Aug 2026 00:43:16 +0530 Subject: [PATCH] fix(router): prevent duplicate 'type' argument in cache initialization --- litellm/router.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/litellm/router.py b/litellm/router.py index e7d91859ec6..3804a70797d 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -530,8 +530,10 @@ class Router: cache_config: Final[dict[str, Any]] = {} # FIX: Apply cache_kwargs regardless of whether Redis is used cache_config.update(cache_kwargs) - if "type" in cache_kwargs: - cache_type = cache_kwargs["type"] + if "type" in cache_config: + # Pop removes 'type' from cache_config and assigns it to cache_type. + # This prevents passing 'type' twice to litellm.Cache() later. + cache_type = cache_config.pop("type") self.client_ttl = client_ttl if redis_url is not None or (redis_host is not None and redis_port is not None):