{"record":{"id":"01661792541d457a","repo":"apache/druid","slug":"unable-to-parse-row-s","errorCode":null,"errorMessage":"Unable to parse row [%s]","messagePattern":"Unable to parse row \\[(.+?)\\]","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"warning","filePath":"processing/src/main/java/org/apache/druid/data/input/impl/JsonReader.java","lineNumber":135,"sourceCode":"  }\n\n  @Override\n  protected List<InputRow> parseInputRows(InputEntity entity) throws IOException, ParseException\n  {\n    final List<InputRow> inputRows = new ArrayList<>();\n    try (JsonParser parser = jsonFactory.createParser(entity.open())) {\n      final MappingIterator<JsonNode> delegate = mapper.readValues(parser, JsonNode.class);\n      while (delegate.hasNext()) {\n        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","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/data/input/impl/JsonReader.java#L117-L153","documentation":"JsonReader.parseInputRows catches Jackson's JsonParseException bubbling out of MappingIterator and rethrows it as a Druid ParseException ('Unable to parse row [ ... ]') containing the raw input text, converting Jackson failures into Druid's skippable-record mechanism. Unknown runtime exceptions are rethrown unchanged.","triggerScenarios":"Ill-formed JSON text in the input entity — truncated lines, concatenated objects without newlineDelimited, stray characters, invalid escapes — causing MappingIterator#hasNext/next to throw JsonParseException.","commonSituations":"NDJSON ingested without assumeNewlineDelimited/line-input-format so the parser hits the second object prematurely; truncated files from failed uploads; JSON with trailing commas or single quotes from non-standard producers.","solutions":["Inspect the raw row echoed in the ParseException message for the syntax error","For newline-delimited JSON, set \"assumeNewlineDelimited\": true (or use a newline-delimited input format) instead of feeding an array/root document","Repair or re-export the corrupted/truncated source file","Let Druid skip the bad record if the task's parseException policy tolerates it"],"exampleFix":"// before: NDJSON file read as one JSON doc\n{\"type\":\"json\",\"findColumnsFromHeader\":false}\n// after\n{\"type\":\"json\",\"assumeNewlineDelimited\":true}","handlingStrategy":"try-catch","validationCode":"// Validate JSON text is parseable before feeding the reader\ntry (JsonParser p = objectMapper.getFactory().createParser(rawBytes)) { while (p.nextToken() != null) {} }","typeGuard":null,"tryCatchPattern":"try { rows = reader.read().collect(toList()); } catch (ParseException e) { log.warn(\"Bad row skipped: {}\", e.getMessage()); } catch (RuntimeException e) { throw e; /* non-JSON errors are rethrown by design */ }","preventionTips":["For NDJSON use a newline-delimited format or assumeNewlineDelimited instead of multi-doc parsing","Verify uploads complete (checksum/size) to avoid truncated JSON","Validate producer JSON with a strict schema"],"tags":["json","parse","jackson"],"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-14T05:17:10.506Z"}