{"record":{"id":"2ee6b5e953b50c42","repo":"BerriAI/litellm","slug":"unsupported-duration-unit-passed-duration-durat","errorCode":null,"errorMessage":"Unsupported duration unit, passed duration: {duration}","messagePattern":"Unsupported duration unit, passed duration: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/litellm_core_utils/duration_parser.py","lineNumber":106,"sourceCode":"\n        target_day = min(target_day, last_day_of_target_month)\n\n        next_month: Final = datetime(\n            year=target_year,\n            month=target_month,\n            day=target_day,\n            hour=current_time.hour,\n            minute=current_time.minute,\n            second=current_time.second,\n            microsecond=current_time.microsecond,\n        )\n\n        # Calculate the duration until the first day of the next month\n        duration_until_next_month: Final = next_month - current_time\n        return int(duration_until_next_month.total_seconds())\n\n    else:\n        raise ValueError(f\"Unsupported duration unit, passed duration: {duration}\")\n\n\ndef get_next_standardized_reset_time(\n    duration: str,\n    current_time: datetime,\n    timezone_str: str = \"UTC\",\n    reset_time_of_day: time = time(0, 0),\n) -> datetime:\n    \"\"\"\n    Get the next standardized reset time based on the duration.\n\n    All durations will reset at predictable intervals, aligned from the current time:\n    - Nd: If N=1, reset at the next `reset_time_of_day`; if N>1, reset every N days from now\n    - Nh: Every N hours, aligned to hour boundaries (e.g., 1:00, 2:00)\n    - Nm: Every N minutes, aligned to minute boundaries (e.g., 1:05, 1:10)\n    - Ns: Every N seconds, aligned to second boundaries\n\n    Parameters:","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/duration_parser.py#L88-L124","documentation":"Generic guard in the duration-to-seconds calculator: the parsed unit is not one of the supported units (s, m, h, d, w, mo), so the duration cannot be converted to seconds. Fires when a duration string parses but uses a unit the calculator has no branch for.","triggerScenarios":"Thrown at litellm/litellm_core_utils/duration_parser.py:106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported duration unit (s, m, h, d, w, mo); the passed duration uses an unsupported unit.","Convert the value to a supported unit before passing."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}