From 188e3a7cbcdeb0f892b6b36d7b9a40f6bf71a4c0 Mon Sep 17 00:00:00 2001 From: soroush5 Date: Fri, 11 Sep 2026 11:53:11 +0330 Subject: [PATCH] fix(proxy): appease type-discipline gate for key duration error envelope --- litellm/proxy/management_endpoints/common_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/management_endpoints/common_utils.py b/litellm/proxy/management_endpoints/common_utils.py index 61d610babb1..8e1fd17ac8d 100644 --- a/litellm/proxy/management_endpoints/common_utils.py +++ b/litellm/proxy/management_endpoints/common_utils.py @@ -38,9 +38,10 @@ def validate_key_duration(duration: str | None) -> None: try: duration_in_seconds(duration) except (ValueError, OverflowError): + message = f"Invalid duration '{duration}'. Use a format like '1h', '24h', '7d', or '30d'." raise HTTPException( status_code=400, - detail={"error": f"Invalid duration '{duration}'. Use a format like '1h', '24h', '7d', or '30d'."}, + detail={"error": message}, # mutable-ok: single-shot error envelope )