apache/cassandra · error · MarshalException
Input date %s is greater than max supported date %s
Error message
Input date %s is greater than max supported date %s
What it means
SimpleDateSerializer encodes CQL 'date' values as an unsigned int of days since epoch offset by Integer.MIN_VALUE. dateStringToDays parses an ISO-8601 date string (e.g. 2011-02-03 or +5877642-06-15) to epoch millis and rejects values outside the supported range [-5877641-06-23, +5877642-06-15]. This error means the input date parsed fine but its epoch millis exceed maxSupportedDateMillis, i.e. the date is later than Cassandra's max representable date.
Source
Thrown at src/java/org/apache/cassandra/serializers/SimpleDateSerializer.java:77
public static int dateStringToDays(String source) throws MarshalException
{
// Raw day value in unsigned int form, epoch @ 2^31
if (rawPattern.matcher(source).matches())
{
return parseRaw(source);
}
// Attempt to parse as date string
try
{
LocalDate parsed = formatter.parse(source, LocalDate::from);
long millis = parsed.atStartOfDay(UTC).toInstant().toEpochMilli();
if (millis < minSupportedDateMillis)
throw new MarshalException(String.format("Input date %s is less than min supported date %s", source,
ZonedDateTime.ofInstant(Instant.ofEpochMilli(minSupportedDateMillis), UTC).toString()));
if (millis > maxSupportedDateMillis)
throw new MarshalException(String.format("Input date %s is greater than max supported date %s", source,
ZonedDateTime.ofInstant(Instant.ofEpochMilli(maxSupportedDateMillis), UTC).toString()));
return timeInMillisToDay(millis);
}
catch (DateTimeParseException| ArithmeticException e1)
{
throw new MarshalException(String.format("Unable to coerce '%s' to a formatted date (long)", source), e1);
}
}
private static int parseRaw(String source) {
try
{
long result = Long.parseLong(source);
if (result < 0 || result > maxSupportedDays)
throw new NumberFormatException("Input out of bounds: " + source);
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Use a date within the supported range -5877641-06-23 through +5877642-06-15
- If a far-future date is needed, store it as text or as a timestamp/bigint column instead of date
- Validate the input year before inserting (e.g. reject years > 5877642)
- Insert the raw unsigned-int day encoding via timeInMillisToDay semantics if you truly need an out-of-range logical date
Example fix
// before INSERT INTO events (id, day) VALUES (1, '9999999-01-01'); // after INSERT INTO events (id, day) VALUES (1, '2026-09-09');
Defensive patterns
Strategy: validation
Validate before calling
LocalDate d = LocalDate.parse(input, DateTimeFormatter.ISO_LOCAL_DATE);
long millis = d.atStartOfDay(ZoneOffset.UTC).toInstant().toEpochMilli();
if (millis > SimpleDateSerializer.maxSupportedDateMillis) throw new IllegalArgumentException("date out of range: " + input); Type guard
boolean isValidCqlDate(String s) {
try { LocalDate.parse(s, DateTimeFormatter.ISO_LOCAL_DATE); return true; }
catch (DateTimeParseException e) { return false; }
} Try / catch
try {
int days = SimpleDateSerializer.dateStringToDays(input);
} catch (MarshalException e) {
log.error("Invalid date value {}: {}", input, e.getMessage());
throw new BadRequestException("date must be within -5877641-06-23..+5877642-06-15");
} Prevention
- Restrict user input with an HTML date picker constrained to the supported range
- Validate dates at the application edge before CQL insert
- Prefer passing typed LocalDate objects through a driver codec rather than strings
- Document the date type's limited range for consumers of your schema
When it happens
Trigger: Calling dateStringToDays (or inserting into a date column via CQL) with an ISO date string whose instant is after the maximum supported date (~+5877642-06-15); e.g. '9999-12-31' is fine but extreme far-future dates beyond year 5877642 overflow.
Common situations: Data migrated from systems allowing wider date ranges; user-supplied date strings passed straight into a date column; generated test data with extreme future dates; confusion between date (day-resolution, limited range) and timestamp types.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- The duration months must be a 32 bits integer but was: %d
- The duration days must be a 32 bits integer but was: %d
- Input date %s is less than min supported date %s
- Unable to coerce '%s' to a formatted date (long)
- Unable to make unsigned int (for date) from: '%s'
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/dbb881c1990a14b2.
Report an issue: GitHub.