{"record":{"id":"3819498db281fc63","repo":"BerriAI/litellm","slug":"param-name-must-be-a-yyyy-mm-dd-date-got-value","errorCode":null,"errorMessage":"{param_name} must be a YYYY-MM-DD date, got {value!r}","messagePattern":"(.+?) must be a YYYY-MM-DD date, got (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/analytics_endpoints/analytics_endpoints.py","lineNumber":19,"sourceCode":"#### Analytics Endpoints #####\nfrom datetime import datetime, timezone\nfrom typing import Annotated, Final\n\nimport fastapi\nfrom fastapi import APIRouter, Depends, HTTPException, status\n\nfrom litellm.proxy._types import *\nfrom litellm.proxy.analytics_endpoints.cache_activity import CacheActivityResponse, get_cache_activity\nfrom litellm.proxy.auth.user_api_key_auth import user_api_key_auth\n\nrouter: Final = APIRouter()\n\n\ndef _parse_date(value: str, param_name: str) -> datetime:\n    try:\n        return datetime.strptime(value, \"%Y-%m-%d\").replace(tzinfo=timezone.utc)\n    except ValueError:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail={\"error\": f\"{param_name} must be a YYYY-MM-DD date, got {value!r}\"},\n        )\n\n\n@router.get(\n    \"/global/activity/cache_hits\",\n    tags=[\"Budget & Spend Tracking\"],\n    dependencies=[Depends(user_api_key_auth)],\n    response_model=CacheActivityResponse,\n    include_in_schema=False,\n)\nasync def get_global_activity(\n    start_date: Annotated[str, fastapi.Query(description=\"Time from which to start viewing spend\")],\n    end_date: Annotated[str, fastapi.Query(description=\"Time till which to view spend\")],\n    key_aliases: Annotated[\n        list[str] | None, fastapi.Query(description=\"Only include spend from these key aliases\")\n    ] = None,","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/analytics_endpoints/analytics_endpoints.py#L1-L37","documentation":"Raised by the _parse_date helper (used for start_date/end_date query params on analytics endpoints) when datetime.strptime(value, '%Y-%m-%d') fails. The offending parameter name and raw value are embedded; common causes are full timestamps ('2024-01-01T00:00:00') or slashed dates ('01/02/2024') where the plain ISO calendar date is required.","triggerScenarios":"Thrown at litellm/proxy/analytics_endpoints/analytics_endpoints.py:19 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the parameter as a YYYY-MM-DD date string."],"exampleFix":"start_date='2026-08-01'","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-14T05:17:10.506Z"}