{"record":{"id":"ec6dd56b1858208b","repo":"apache/druid","slug":"unable-to-parse-row-s-ec6dd5","errorCode":null,"errorMessage":"Unable to parse row [%s]","messagePattern":"Unable to parse row \\[(.+?)\\]","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/java/util/common/parsers/RegexParser.java","lineNumber":109,"sourceCode":"      final Matcher matcher = compiled.matcher(input);\n\n      if (!matcher.matches()) {\n        throw new ParseException(input, \"Incorrect Regex: %s . No match found.\", pattern);\n      }\n\n      List<String> values = new ArrayList<>();\n      for (int i = 1; i <= matcher.groupCount(); i++) {\n        values.add(matcher.group(i));\n      }\n\n      if (fieldNames == null) {\n        setFieldNames(ParserUtils.generateFieldNames(values.size()));\n      }\n\n      return Utils.zipMapPartial(fieldNames, Iterables.transform(values, valueFunction));\n    }\n    catch (Exception e) {\n      throw new ParseException(input, e, \"Unable to parse row [%s]\", input);\n    }\n  }\n\n  @Override\n  public void setFieldNames(Iterable<String> fieldNames)\n  {\n    ParserUtils.validateFields(fieldNames);\n    this.fieldNames = Lists.newArrayList(fieldNames);\n  }\n\n  @Override\n  public List<String> getFieldNames()\n  {\n    return fieldNames;\n  }\n}\n","sourceCodeStart":91,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/java/util/common/parsers/RegexParser.java#L91-L126","documentation":"parseToMap wraps all parsing work in a try/catch and rethrows any failure (bad group counts, field-name mismatches, value conversion problems) as a ParseException 'Unable to parse row [<input>]'. It is the generic catch-all for rows that RegexParser cannot convert to a field/value map, with the original exception attached as the cause.","triggerScenarios":"Any exception inside parseToMap after a successful regex match: e.g. zipMapPartial/Iterables.transform failing in the valueFunction, mismatch between number of captured groups and fieldNames, or malformed input causing downstream value parsing to fail.","commonSituations":"Field-name list shorter/longer than captured groups after setFieldNames; custom value function (e.g. timestamp parser) rejecting a captured value; input row subtly malformed even though the regex matched.","solutions":["Inspect the ParseException cause (getCause()) to see the underlying failure","Ensure the number of fieldNames matches the number of capture groups in the pattern","Validate sample rows against both the regex and the value function before ingestion","Add try/catch around parseToMap calls to log and skip unparseable rows instead of failing the batch"],"exampleFix":"// before\nMap<String,Object> row = parser.parseToMap(line); // throws on bad row\n// after\ntry {\n  Map<String,Object> row = parser.parseToMap(line);\n} catch (ParseException e) {\n  log.warn(e, \"Skipping unparseable row\");\n}","handlingStrategy":"try-catch","validationCode":"if (line == null || line.isEmpty()) {\n  throw new IllegalArgumentException(\"Empty input row\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  return parser.parseToMap(line);\n} catch (ParseException e) {\n  log.error(e.getCause(), \"Failed to parse row [%s]\", line);\n  throw e; // or skip, depending on pipeline policy\n}","preventionTips":["Always inspect getCause() — this error wraps the real failure","Keep fieldNames count aligned with the regex capture-group count","Test rows end-to-end with the exact valueFunction configured","Skip-and-log bad rows in ingestion pipelines to avoid full-batch failure"],"tags":["parsing","druid","exception-handling"],"backgroundTag":"record-not-found","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"}