{"record":{"id":"412b74478feda3bb","repo":"BerriAI/litellm","slug":"start-date-must-be-on-or-before-end-date","errorCode":null,"errorMessage":"start_date must be on or before end_date","messagePattern":"start_date must be on or before end_date","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/tag_management_endpoints.py","lineNumber":568,"sourceCode":"def _validate_tag_list_date_range(start_date: str | None, end_date: str | None) -> None:\n    \"\"\"Require both dates together, and enforce YYYY-MM-DD format with start <= end.\"\"\"\n    if (start_date is None) != (end_date is None):\n        raise HTTPException(\n            status_code=400,\n            detail=\"start_date and end_date must be provided together\",\n        )\n    if start_date is None:\n        return\n    try:\n        start: Final = datetime.strptime(start_date, \"%Y-%m-%d\")\n        end: Final = datetime.strptime(end_date, \"%Y-%m-%d\")\n    except ValueError as e:\n        raise HTTPException(\n            status_code=400,\n            detail=f\"Invalid date format, expected YYYY-MM-DD: {e}\",\n        )\n    if start > end:\n        raise HTTPException(\n            status_code=400,\n            detail=\"start_date must be on or before end_date\",\n        )\n\n\n@router.get(\n    \"/tag/list\",\n    tags=[\"tag management\"],\n    dependencies=[Depends(user_api_key_auth)],\n)\nasync def list_tags(\n    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),\n    start_date: str | None = Query(\n        None,\n        description=(\n            \"Optional start date (YYYY-MM-DD). When provided together with \"\n            \"end_date, dynamic tags are limited to those active in the window. \"\n            \"Stored tags are always returned.\"","sourceCodeStart":550,"sourceCodeEnd":586,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/tag_management_endpoints.py#L550-L586","documentation":"Range sanity check for tag listing: after parsing both dates, start_date greater than end_date is rejected with 400 because an inverted range can never match data. At-fault input is an out-of-order date pair.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/tag_management_endpoints.py:568 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set start_date on or before end_date."],"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-14T00:17:10.932Z"}