apache/druid · error · ParseException

Incorrect Regex: %s . No match found.

Error message

Incorrect Regex: %s . No match found.

What it means

RegexParser.parseToMap applies the configured regex to an input row using Matcher.matches(), which requires the whole string to match. If the pattern does not match the entire input, a ParseException with 'Incorrect Regex: <pattern> . No match found.' is thrown. This signals that the row content does not conform to the expected delimited/regex structure.

Source

Thrown at processing/src/main/java/org/apache/druid/java/util/common/parsers/RegexParser.java:94

  public RegexParser(
      final String pattern,
      final Optional<String> listDelimiter,
      final Iterable<String> fieldNames
  )
  {
    this(pattern, listDelimiter);

    setFieldNames(fieldNames);
  }

  @Override
  public Map<String, Object> parseToMap(String input)
  {
    try {
      final Matcher matcher = compiled.matcher(input);

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

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

      if (fieldNames == null) {
        setFieldNames(ParserUtils.generateFieldNames(values.size()));
      }

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

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Verify the regex matches the ENTIRE line; anchor it or wrap with .* where appropriate (e.g. ".*?(\\d+)\\s+.*") since matches() is used
  2. Test the pattern against a representative sample row with Matcher.matches() before configuring ingestion
  3. Fix or regenerate the malformed input rows, or filter/skip them before parsing
  4. If only part of the line should match, switch ingestion to a parser that uses find()-style matching or preprocess the input

Example fix

// before
parser.setPattern("(\\w+) (\\d+)"); // line: "user 42 extra"
Map<String,Object> row = parser.parseToMap("user 42 extra"); // throws
// after
parser.setPattern("(\\w+) (\\d+).*");
Map<String,Object> row = parser.parseToMap("user 42 extra"); // OK
Defensive patterns

Strategy: validation

Validate before calling

final java.util.regex.Pattern p = java.util.regex.Pattern.compile(pattern);
if (!p.matcher(sampleLine).matches()) {
  throw new IllegalArgumentException("Pattern does not match sample line: " + sampleLine);
}

Type guard

boolean rowMatches(Pattern p, String line) {
  return line != null && p != null && p.matcher(line).matches();
}

Try / catch

try {
  return parser.parseToMap(line);
} catch (ParseException e) {
  log.warn("Unparseable row [%s]: %s", line, e.getMessage());
  return Collections.emptyMap();
}

Prevention

When it happens

Trigger: Calling parseToMap(String) with input that does not fully match the pattern set via setPattern/findPattern; also any time the compiled matcher's matches() returns false.

Common situations: Ingesting log lines whose format drifted from the configured regex; pattern written with find() semantics in mind (partial match) instead of matches() (full match); rows containing unescaped characters or optional fields absent; wrong parser chosen for TSV/CSV data.

Related errors


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