apache/druid · error · ParseException

Incorrect Regex: . No match found.

Error message

Incorrect Regex: %s . No match found.

What it means

RegexReader.parseLine throws this ParseException when the configured regular expression does not match the input line. The regex must match the entire line (matcher.matches()), and any non-matching line is rejected with the pattern included in the message.

Solutions

  1. Adjust the regex so it matches the full line and all expected lines
  2. Add anchors or optional groups for variable line shapes
  3. Filter out blank/comment lines before parsing
  4. Set high maxParseExceptions to skip unmatched lines during ingestion

Example fix

// before
"pattern": "(\\d+)"  // fails on lines with extra text
// after
"pattern": "^.*?(\\d+).*$"
Defensive patterns

Strategy: validation

Validate before calling

Pattern p = Pattern.compile(pattern); if (!p.matcher(sampleLine).matches()) { /* pattern does not fully match line */ }

Type guard

boolean lineMatches(String line, String pattern) { return Pattern.compile(pattern).matcher(line).matches(); }

Try / catch

try { reader.read(); } catch (ParseException e) { log.warn("Line did not match regex: {}", e.getMessage()); }

Prevention

When it happens

Trigger: A log/input line whose structure does not fully match the configured pattern - e.g. the line is blank, a comment, or from a different log format.

Common situations: Regex written for find() semantics but matches() requires full-line coverage (missing anchors or .*), multiline log entries split across lines, empty trailing lines, mixed log formats in one file.

Related errors


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

Appendix: source

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

  @Override
  public List<InputRow> parseInputRows(String intermediateRow) throws ParseException
  {
    return Collections.singletonList(MapInputRowParser.parse(getInputRowSchema(), parseLine(intermediateRow)));
  }

  @Override
  protected List<Map<String, Object>> toMap(String intermediateRow)
  {
    return Collections.singletonList(parseLine(intermediateRow));
  }

  private Map<String, Object> parseLine(String line)
  {
    try {
      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);
    }
  }

View on GitHub (pinned to 9b90983fd2)