From 43972a414dd2bcd4977937df27b8042a0524a375 Mon Sep 17 00:00:00 2001 From: LeeJuOh Date: Sun, 22 Feb 2026 15:41:58 +0900 Subject: [PATCH] fix(budget): log warning on timezone fallback to UTC When ZoneInfo fails to load a configured timezone (e.g. missing tzdata), the code silently falls back to UTC. Add a verbose_logger.warning() so operators can see which timezone failed and how to fix it. --- litellm/litellm_core_utils/duration_parser.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/duration_parser.py b/litellm/litellm_core_utils/duration_parser.py index 70c28c4e067..66f59b66da5 100644 --- a/litellm/litellm_core_utils/duration_parser.py +++ b/litellm/litellm_core_utils/duration_parser.py @@ -12,6 +12,8 @@ from datetime import datetime, timedelta, timezone, tzinfo from typing import Optional, Tuple from zoneinfo import ZoneInfo +from litellm._logging import verbose_logger + def _extract_from_regex(duration: str) -> Tuple[int, str]: match = re.match(r"(\d+)(mo|[smhdw]?)", duration) @@ -156,7 +158,11 @@ def _setup_timezone( else: tz = ZoneInfo(timezone_str) except Exception: - # If timezone is invalid, fall back to UTC + verbose_logger.warning( + "Failed to load timezone '%s', falling back to UTC. " + "Install 'tzdata' package for full timezone support.", + timezone_str, + ) tz = timezone.utc # Convert current_time to the target timezone