BerriAI/litellm · error · HTTPException

start_date and end_date must be provided together

Error message

start_date and end_date must be provided together

What it means

_validate_tag_list_date_range enforces paired date filters: supplying exactly one of start_date/end_date to tag listing is ambiguous, so a 400 is raised. At-fault input is an unpaired optional date-range parameter.

Source

Thrown at litellm/proxy/management_endpoints/tag_management_endpoints.py:553

                "updated_at": tag_record.updated_at.isoformat(),
                "created_by": tag_record.created_by,
            }

            # Add budget info if available
            if hasattr(tag_record, "litellm_budget_table") and tag_record.litellm_budget_table:
                tag_dict["litellm_budget_table"] = tag_record.litellm_budget_table

            requested_tags[tag_record.tag_name] = tag_dict

        return requested_tags
    except Exception as e:
        raise HTTPException(status_code=500, detail=str(e))


def _validate_tag_list_date_range(start_date: str | None, end_date: str | None) -> None:
    """Require both dates together, and enforce YYYY-MM-DD format with start <= end."""
    if (start_date is None) != (end_date is None):
        raise HTTPException(
            status_code=400,
            detail="start_date and end_date must be provided together",
        )
    if start_date is None:
        return
    try:
        start: Final = datetime.strptime(start_date, "%Y-%m-%d")
        end: Final = datetime.strptime(end_date, "%Y-%m-%d")
    except ValueError as e:
        raise HTTPException(
            status_code=400,
            detail=f"Invalid date format, expected YYYY-MM-DD: {e}",
        )
    if start > end:
        raise HTTPException(
            status_code=400,
            detail="start_date must be on or before end_date",
        )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide both start_date and end_date, or neither.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/tag_management_endpoints.py:553 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/718d005204f3de7f. Report an issue: GitHub.