{"record":{"id":"23e8e78bae4b3793","repo":"apache/druid","slug":"unable-to-parse-s-as-the-intermediaterow-result","errorCode":null,"errorMessage":"Unable to parse [%s] as the intermediateRow resulted in empty input row","messagePattern":"Unable to parse \\[(.+?)\\] as the intermediateRow resulted in empty input row","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"warning","filePath":"processing/src/main/java/org/apache/druid/data/input/impl/JsonNodeReader.java","lineNumber":151,"sourceCode":"\n  @Override\n  protected InputEntity source()\n  {\n    return source;\n  }\n\n  @Override\n  protected List<InputRow> parseInputRows(JsonNode intermediateRow) throws ParseException\n  {\n    if (intermediateRow instanceof ParseExceptionMarkerJsonNode) {\n      throw ((ParseExceptionMarkerJsonNode) intermediateRow).getParseException();\n    }\n    final List<InputRow> inputRows = Collections.singletonList(\n        MapInputRowParser.parse(inputRowSchema, flattener.flatten(intermediateRow))\n    );\n\n    if (CollectionUtils.isNullOrEmpty(inputRows)) {\n      throw new ParseException(\n          intermediateRow.toString(),\n          \"Unable to parse [%s] as the intermediateRow resulted in empty input row\",\n          intermediateRow.toString()\n      );\n    }\n    return inputRows;\n  }\n\n  @Override\n  protected List<Map<String, Object>> toMap(JsonNode intermediateRow) throws IOException\n  {\n    if (intermediateRow instanceof ParseExceptionMarkerJsonNode) {\n      throw ((ParseExceptionMarkerJsonNode) intermediateRow).getParseException();\n    }\n    return Collections.singletonList(\n        mapper.readValue(intermediateRow.toString(), new TypeReference<>() {})\n    );\n  }","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/data/input/impl/JsonNodeReader.java#L133-L169","documentation":"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.","triggerScenarios":"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.","commonSituations":"Malformed or null JSON lines inside newline-delimited files; flattenSpec expressions that match nothing; upstream producers emitting empty records or tombstones.","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"],"exampleFix":"// before: record {\"a\":null} with flattenSpec expecting \"a.b\" -> empty row\n// after: fix flattenSpec\n\"flattenSpec\": {\"useFieldDiscovery\": true, \"fields\": [{\"name\":\"a\",\"type\":\"root\"}]}","handlingStrategy":"try-catch","validationCode":"// Pre-validate NDJSON lines before ingestion\nfor (String line : lines) {\n    JsonNode n = objectMapper.readTree(line);\n    if (n == null || n.isNull() || (n.isObject() && n.isEmpty())) log.warn(\"Skipping empty record\");\n}","typeGuard":"static boolean isEmptyRecord(JsonNode node) { return node == null || node.isNull() || (node.isContainerNode() && node.isEmpty()); }","tryCatchPattern":"try { reader.read(); } catch (ParseException e) { parseMetrics.skipped++; log.warn(e.getMessage()); /* continue; Druid tolerates ParseExceptions up to maxParseExceptions */ }","preventionTips":["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"],"tags":["json","parse","data-quality"],"backgroundTag":"json-parse-error","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}