apache/druid · error · ParseException

Unable to parse row [ ]

Error message

Unable to parse row [%s]

What it means

RegexReader.parseLine wraps any unexpected exception during column/value processing of a matched line into this ParseException, carrying the raw line. It fires after the regex matched but something went wrong mapping captured groups to columns (e.g. transformation function failure).

Solutions

  1. Review the cause exception inside the ParseException for the failing step
  2. Make the transformation function null-safe or wrap it defensively
  3. Verify column list length and header configuration match groupCount
  4. Fix the offending line content identified by the row text in the message

Example fix

// before
transformationFunction = v -> Long.parseLong(v)  // NPE on null group
// after
transformationFunction = v -> v == null ? 0L : Long.parseLong(v)
Defensive patterns

Strategy: try-catch

Validate before calling

try { transformationFunction.apply(sampleValue); } catch (Exception e) { /* transformation unsafe */ }

Type guard

boolean transformSafe(String v) { try { fn.apply(v); return true; } catch (Exception e) { return false; } }

Try / catch

try { reader.read(); } catch (ParseException e) { log.warn("Row processing failed: {} cause: {}", e.getMessage(), e.getCause()); }

Prevention

When it happens

Trigger: A transformationFunction applied to captured groups throws, or column list construction (generateFieldNames or header-derived columns) fails while zipping values with columns via Utils.zipMapPartial.

Common situations: Custom transformations that assume non-null or numeric values, header line mismatch causing wrong column counts, exceptions inside lambda transformations on malformed group content.

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.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/5d77bf5b69437fcb. Report an issue: GitHub.

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/data/input/impl/RegexReader.java:104

      final RegexMatcher matcher = compiledPattern.matcher(line);

      if (!matcher.matches()) {
        throw new ParseException(line, "Incorrect Regex: %s . No match found.", pattern);
      }

      final List<String> values = new ArrayList<>();
      for (int i = 1; i <= matcher.groupCount(); i++) {
        values.add(matcher.group(i));
      }

      if (columns == null) {
        columns = ParserUtils.generateFieldNames(matcher.groupCount());
      }

      return Utils.zipMapPartial(columns, Iterables.transform(values, transformationFunction));
    }
    catch (Exception e) {
      throw new ParseException(line, e, "Unable to parse row [%s]", line);
    }
  }

  @Override
  public int getNumHeaderLinesToSkip()
  {
    return 0;
  }

  @Override
  public boolean needsToProcessHeaderLine()
  {
    return false;
  }

  @Override
  public void processHeaderLine(String line)
  {

View on GitHub (pinned to 9b90983fd2)