{"record":{"id":"7a3cf4107bc6aa48","repo":"apache/druid","slug":"unable-to-parse-s-as-the-intermediaterow-result-7a3cf4","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/JsonReader.java","lineNumber":144,"sourceCode":"        final JsonNode row = delegate.next();\n        inputRows.add(MapInputRowParser.parse(inputRowSchema, flattener.flatten(row)));\n      }\n    }\n    catch (RuntimeException e) {\n      //convert Jackson's JsonParseException into druid's exception for further processing\n      //JsonParseException will be thrown from MappingIterator#hasNext or MappingIterator#next when input json text is ill-formed\n      if (e.getCause() instanceof JsonParseException) {\n        final String rowAsString = IOUtils.toString(entity.open(), StandardCharsets.UTF_8);\n        throw new ParseException(rowAsString, e, \"Unable to parse row [%s]\", rowAsString);\n      }\n\n      //throw unknown exception\n      throw e;\n    }\n\n    if (inputRows.isEmpty()) {\n      final String rowAsString = IOUtils.toString(entity.open(), StandardCharsets.UTF_8);\n      throw new ParseException(\n          rowAsString,\n          \"Unable to parse [%s] as the intermediateRow resulted in empty input row\",\n          rowAsString\n      );\n    }\n\n    return inputRows;\n  }\n\n  @Override\n  protected List<Map<String, Object>> toMap(InputEntity entity) throws IOException\n  {\n    try (JsonParser parser = jsonFactory.createParser(entity.open())) {\n      final MappingIterator<Map> delegate = mapper.readValues(parser, Map.class);\n      return FluentIterable.from(() -> delegate)\n                           .transform(map -> (Map<String, Object>) map)\n                           .toList();\n    }","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/data/input/impl/JsonReader.java#L126-L162","documentation":"After JsonReader.parseInputRows collects rows from a JSON record, an empty result triggers a ParseException ('Unable to parse [ ... ] as the intermediateRow resulted in empty input row') echoing the raw input. Like other Druid ParseExceptions this marks the record unparseable so it is counted/skipped rather than crashing the task.","triggerScenarios":"A record deserializes successfully but yields zero InputRows — e.g. a null JSON value, an empty object/array filtered out by the parser, or records whose flattened content is entirely discarded.","commonSituations":"Producers emitting null placeholder lines in NDJSON streams; empty objects {} in the data; upstream systems writing tombstone records; last truncated line of a file.","solutions":["Check the echoed raw row to identify the empty/null record","Scrub null/empty lines from the source or fix the producer","Adjust the parse spec so such records produce a row (e.g. flattenSpec) if they should be ingested","Accept skipping: ensure maxParseExceptions/task logs are configured to tolerate skipped records"],"exampleFix":"// before: stream contains bare 'null' lines -> empty row\n// after: preprocess input\n//   grep -v '^null$' input.ndjson > cleaned.ndjson","handlingStrategy":"try-catch","validationCode":"// Detect records that flatten to nothing before ingestion\nJsonNode node = objectMapper.readTree(raw);\nif (node == null || node.isNull() || node.isEmpty()) { skip(raw); }","typeGuard":"static boolean producesNoRow(JsonNode node) { return node == null || node.isNull() || (node.isContainerNode() && node.isEmpty()); }","tryCatchPattern":"try { rows = reader.read().collect(toList()); } catch (ParseException e) { deadLetterQueue.add(e.getMessage()); /* record echoes raw input; inspect and reprocess */ }","preventionTips":["Filter null/tombstone records at the producer or with a preprocessing step","Set maxParseExceptions appropriately for datasets with known-dirty records","Monitor parseMetrics/skip counts to catch systematic empty-record emission"],"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"}