BerriAI/litellm · error · HTTPException

Invalid date format: {value}. Expected: 'YYYY-MM-DD'

Error message

Invalid date format: {value}. Expected: 'YYYY-MM-DD'

What it means

Error "Invalid date format: {value}. Expected: 'YYYY-MM-DD'" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/tool_management_endpoints.py:213

    if prisma_client is None:
        raise HTTPException(status_code=500, detail=CommonProxyErrors.db_not_connected_error.value)

    try:
        tools: Final = await db_list_tools(prisma_client=prisma_client, input_policy=input_policy)
        return ToolListResponse(tools=tools, total=len(tools))
    except Exception as e:
        verbose_proxy_logger.exception("Error listing tools: %s", e)
        raise HTTPException(status_code=500, detail=str(e))


def _parse_day_start(value: str | None) -> datetime | None:
    if not value:
        return None
    try:
        return datetime.strptime(value.strip(), "%Y-%m-%d").replace(tzinfo=timezone.utc)
    except ValueError:
        raise HTTPException(
            status_code=400,
            detail=f"Invalid date format: {value}. Expected: 'YYYY-MM-DD'",
        )


class _ToolSpendSums(BaseModel):
    spend: float = 0.0
    total_tokens: int = 0
    request_count: int = 0


class _TopToolRow(BaseModel):
    tool_name: str
    sums: _ToolSpendSums = Field(alias="_sum")


_TOP_TOOL_ROWS: Final = TypeAdapter(list[_TopToolRow])

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass dates in 'YYYY-MM-DD' format.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/tool_management_endpoints.py:213 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/73b093fa80c7defe. Report an issue: GitHub.