OpenAPITools/openapi-generator · error · ParserException

The pattern *** is invalid.

Error message

The pattern *** is invalid.

What it means

IgnoreLineParser throws ParserException when a pattern in .openapi-generator-ignore contains three consecutive '*' characters ('***'). In gitignore-style syntax only single '*' and double '**' are meaningful, so '***' is rejected rather than silently mis-matching.

Source

Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/ignore/rules/IgnoreLineParser.java:91

                    }
                } else if ("\\".equals(current) && "#".equals(next)) {
                    //: Put a backslash ("`\`") in front of the first hash for patterns
                    //: that begin with a hash.
                    // NOTE: Just push forward and drop the escape character. Falls through to TEXT token.
                    current = next;
                    next = null;
                    i++;
                }
            }

            if (Token.MATCH_ANY.pattern.equals(current)) {

                if (Token.MATCH_ANY.pattern.equals(next)) {
                    // peek ahead for invalid pattern. Slightly inefficient, but acceptable.
                    if ((i + 2 < totalLength - 1) &&
                            String.valueOf(characters[i + 2]).equals(Token.MATCH_ANY.pattern)) {
                        // It doesn't matter where we are in the pattern, *** is invalid.
                        throw new ParserException("The pattern *** is invalid.");
                    }

                    parts.add(new Part(Token.MATCH_ALL));
                    i++;
                    continue;
                } else {

                    if (sb.length() > 0) {
                        // A MATCH_ANY may commonly follow a filename or some other character. Dump that to results before the MATCH_ANY.
                        parts.add(new Part(Token.TEXT, sb.toString()));
                        sb.delete(0, sb.length());
                    }

                    parts.add(new Part(Token.MATCH_ANY));
                    continue;
                }
            }

View on GitHub (pinned to fcec517be3)

Solutions

  1. Replace '***' with '**' in the offending pattern.
  2. If the literal filename really contains '***', escape each star with a backslash (e.g. \*\*\*).
  3. Re-check the whole file — parsing stops at the first invalid line, so more may follow.

Example fix

# .openapi-generator-ignore (before):
***/generated/**
# after:
**/generated/**
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: lint .openapi-generator-ignore before generation
for (String line : Files.readAllLines(Paths.get(outputDir, ".openapi-generator-ignore"))) {
    if (line.contains("***"))
        throw new IllegalStateException("Invalid ignore pattern (*** not allowed): " + line);
}

Prevention

When it happens

Trigger: A line in .openapi-generator-ignore such as '***/*.java' or '/src/***' — the parser peeks ahead from a '**' and, on finding a third '*', throws before generation starts.

Common situations: Typo where '**' was meant; patterns copied from another tooling ecosystem whose globs tolerate '***'; find/replace edits that collapsed two patterns together.

Related errors


AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22). Data as JSON: /api/errors/86e875bccab3c3d9. Report an issue: GitHub.