BerriAI/litellm · error · HTTPException

Invalid date format. Use YYYY-MM-DD: {e}

Error message

Invalid date format. Use YYYY-MM-DD: {e}

What it means

HTTPException(400) raised in the tag-summary analytics endpoint when parsing a start/end date parameter fails — the value does not match the YYYY-MM-DD format expected by datetime.strptime. The parse error text is embedded so the caller sees which value was rejected.

Source

Thrown at litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py:641

        db_response: Final = _TAG_SUMMARY_ROWS.validate_python(await _query_raw(prisma_client, sql_query, *params))

        results: Final = [
            TagSummaryMetrics(
                tag=row.tag,
                unique_users=row.unique_users or 0,
                total_requests=int(row.total_requests or 0),
                successful_requests=int(row.successful_requests or 0),
                failed_requests=int(row.failed_requests or 0),
                total_tokens=int(row.total_tokens or 0),
                total_spend=float(row.total_spend or 0.0),
            )
            for row in db_response
        ]

        return TagSummaryResponse(results=results)

    except ValueError as e:
        raise HTTPException(
            status_code=400,
            detail=f"Invalid date format. Use YYYY-MM-DD: {e}",
        )
    except Exception as e:
        raise HTTPException(
            status_code=500,
            detail=f"Failed to fetch tag summary analytics: {e}",
        )


@router.get(
    "/tag/user-agent/per-user-analytics",
    response_model=PerUserAnalyticsResponse,
    tags=["tag management", "user agent analytics"],
    dependencies=[Depends(user_api_key_auth)],
)
async def get_per_user_analytics(
    tag_filter: str | None = Query(

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass dates in YYYY-MM-DD format.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py:641 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/afd61d25d6eaa6c2. Report an issue: GitHub.