ytdl-org/youtube-dl · error · ValueError
Date range: "%s" , the start date must be before the end dat
Error message
Date range: "%s" , the start date must be before the end date
What it means
Error "Date range: "%s" , the start date must be before the end date" thrown in ytdl-org/youtube-dl.
Source
Thrown at youtube_dl/utils.py:3339
else:
return date_str
class DateRange(object):
"""Represents a time interval between two dates"""
def __init__(self, start=None, end=None):
"""start and end must be strings in the format accepted by date"""
if start is not None:
self.start = date_from_str(start)
else:
self.start = datetime.datetime.min.date()
if end is not None:
self.end = date_from_str(end)
else:
self.end = datetime.datetime.max.date()
if self.start > self.end:
raise ValueError('Date range: "%s" , the start date must be before the end date' % self)
@classmethod
def day(cls, day):
"""Returns a range that only contains the given day"""
return cls(day, day)
def __contains__(self, date):
"""Check if the date is in the range"""
if not isinstance(date, datetime.date):
date = date_from_str(date)
return self.start <= date <= self.end
def __str__(self):
return '%s - %s' % (self.start.isoformat(), self.end.isoformat())
def __eq__(self, other):
return (isinstance(other, DateRange)
and self.start == other.start and self.end == other.end)View on GitHub (pinned to 956b8c5855)
Solutions
- Fix the --date range so the start date is before the end date.
When it happens
Trigger: Thrown at youtube_dl/utils.py:3339 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/7cb61583ba583933.
Report an issue: GitHub.