apache/druid · warning · ParseException
Unable to parse [%s] as the intermediateRow resulted in empt
Error message
Unable to parse [%s] as the intermediateRow resulted in empty input row
What it means
JsonNodeReader.parseInputRows throws a Druid ParseException when flattening the intermediate JsonNode produces an empty input row list. This signals the record could not be meaningfully parsed into any row; ParseExceptions are typically counted and the record skipped rather than aborting the task.
Source
Thrown at processing/src/main/java/org/apache/druid/data/input/impl/JsonNodeReader.java:151
@Override
protected InputEntity source()
{
return source;
}
@Override
protected List<InputRow> parseInputRows(JsonNode intermediateRow) throws ParseException
{
if (intermediateRow instanceof ParseExceptionMarkerJsonNode) {
throw ((ParseExceptionMarkerJsonNode) intermediateRow).getParseException();
}
final List<InputRow> inputRows = Collections.singletonList(
MapInputRowParser.parse(inputRowSchema, flattener.flatten(intermediateRow))
);
if (CollectionUtils.isNullOrEmpty(inputRows)) {
throw new ParseException(
intermediateRow.toString(),
"Unable to parse [%s] as the intermediateRow resulted in empty input row",
intermediateRow.toString()
);
}
return inputRows;
}
@Override
protected List<Map<String, Object>> toMap(JsonNode intermediateRow) throws IOException
{
if (intermediateRow instanceof ParseExceptionMarkerJsonNode) {
throw ((ParseExceptionMarkerJsonNode) intermediateRow).getParseException();
}
return Collections.singletonList(
mapper.readValue(intermediateRow.toString(), new TypeReference<>() {})
);
}View on GitHub (pinned to 9b90983fd2)
Solutions
- Inspect the logged intermediate row string to see why flattening produced nothing
- Fix or remove flattenSpec expressions that produce no columns for such records
- Filter or repair upstream records that are null/empty before ingestion
- Rely on Druid's parseException reporting (useRowsForSchema / task logs) to skip bad records if skipping is acceptable
Example fix
// before: record {"a":null} with flattenSpec expecting "a.b" -> empty row
// after: fix flattenSpec
"flattenSpec": {"useFieldDiscovery": true, "fields": [{"name":"a","type":"root"}]} Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-validate NDJSON lines before ingestion
for (String line : lines) {
JsonNode n = objectMapper.readTree(line);
if (n == null || n.isNull() || (n.isObject() && n.isEmpty())) log.warn("Skipping empty record");
} Type guard
static boolean isEmptyRecord(JsonNode node) { return node == null || node.isNull() || (node.isContainerNode() && node.isEmpty()); } Try / catch
try { reader.read(); } catch (ParseException e) { parseMetrics.skipped++; log.warn(e.getMessage()); /* continue; Druid tolerates ParseExceptions up to maxParseExceptions */ } Prevention
- Raise maxParseExceptions or configure tuningConfig skip behavior when dirty upstream data is expected
- Sanitize producer output to exclude null/empty records
- Review flattenSpec fields against real payloads
When it happens
Trigger: A JSON record flattens to zero rows — e.g. a null or empty-object record under a flattenSpec that yields no columns, or record filtering that removes everything from a single-record payload.
Common situations: Malformed or null JSON lines inside newline-delimited files; flattenSpec expressions that match nothing; upstream producers emitting empty records or tombstones.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Unable to parse [%s] as the intermediateRow resulted in empt
- Unable to parse row [%s]
- Failed to parse metric dimensions and types
- Failed to deserialize a DB object
- '%s' must be a string or an array of strings
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/23e8e78bae4b3793.
Report an issue: GitHub.