apache/druid · error · ParseException
Encountered row with timestamp
Error message
Encountered row with timestamp[%s] that cannot be represented as a long: [%s]
What it means
MapInputRowParser throws this ParseException when the parsed timestamp falls outside Intervals.ETERNITY, i.e. it cannot be represented as a Druid long (millis) timestamp - typically out-of-range values like negative or overflowing epoch millis.
Solutions
- Sanitize or clamp outlier timestamps in a transform before parsing
- Check for seconds-vs-millis unit mismatches in the source data
- Reject or reroute such rows via ingestion tuning configs
- Map sentinel dates to a valid range with a format parser
Example fix
// before: data '99999-01-01T00:00:00.000Z'
// after: clamp via transformSpec
"transformSpec": [{"type": "expression", "name": "ts", "expression": "if TIMESTAMP_TO_MILLIS(TIME_PARSE(ts)) > 253402300799000, '9999-12-31T23:59:59.000Z', ts"}] Defensive patterns
Strategy: validation
Validate before calling
long millis = ts.toEpochMilli(); if (millis < 0 || millis > 253402300799000L) { /* out of range */ } Type guard
boolean isRepresentable(Instant t) { return t.toEpochMilli() >= 0 && t.toEpochMilli() <= 253402300799000L; } Try / catch
try { parser.parse(row); } catch (ParseException e) { log.warn("Unrepresentable timestamp: {}", e.getMessage()); } Prevention
- Clamp or sanitize extreme dates before parsing
- Check seconds-vs-millis unit conventions at the source
- Exclude sentinel dates like 0001-01-01 via transforms
When it happens
Trigger: A row whose parsed timestamp is outside the representable long-millis range, so ETERNITY.contains(timestamp) is false (e.g. year 99999 or pre-minimum dates).
Common situations: Timestamps with extreme year values, seconds-vs-millis confusion producing huge epoch values, sentinel dates like 0001-01-01 from upstream systems.
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
- Timestamp[ ] is unparseable! Event
- Attempt to add row to swapped-out sink for segment
- authResult.getErrorMessage()
- Bloom filter aggregators are query-time only
- Can't find previous segmentIds for sequence
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/c8f1804117e0ba6a.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/data/input/impl/MapInputRowParser.java:173
rawMap,
e,
"Timestamp[%s] is unparseable! Event: %s",
timeValue,
rawMap
);
}
if (timestamp == null) {
String rawMap = rawMapToPrint(rawMapSupplier.get());
throw new ParseException(
rawMap,
"Timestamp[%s] is unparseable! Event: %s",
timeValue,
rawMap
);
}
if (!Intervals.ETERNITY.contains(timestamp)) {
String rawMap = rawMapToPrint(rawMapSupplier.get());
throw new ParseException(
rawMap,
"Encountered row with timestamp[%s] that cannot be represented as a long: [%s]",
timestamp,
rawMap
);
}
return timestamp;
}
@Nullable
private static String rawMapToPrint(@Nullable Map<String, ?> rawMap)
{
if (rawMap == null) {
return null;
}
final String input = rawMap.toString();
return input.length() < 100 ? input : input.substring(0, 100) + "...";
}View on GitHub (pinned to 9b90983fd2)