OpenAPITools/openapi-generator · error · IllegalArgumentException

%s Input: `%s`. Error: %s

Error message

%s Input: `%s`. Error: %s

What it means

BaseFilter.parse() wraps any RuntimeException raised while parsing a normalizer filter string and rethrows it as IllegalArgumentException with the filter's usage message, the raw input, and the underlying error. Since 7.16.0 this is a breaking change: malformed FILTER or SECURITY_SCHEMES_FILTER values now abort generation instead of being silently ignored (the source comment says 'Workaround: fix the syntax!'). The message itself is assembled from whatever inner failure occurred — typically error 23 (missing/extra colon) or 24 (unknown filter key).

Source

Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java:2478

        /**
         * Perform the parsing of the filter string.
         *
         * @return true if filters need to be processed
         */
        public boolean parse() {
            if (StringUtils.isEmpty(input)) {
                return false;
            }
            try {
                doParse();
                return hasFilter();
            } catch (RuntimeException e) {
                String usage = usageMessage();
                String message = String.format(Locale.ROOT, "%s Input: `%s`. Error: %s", usage, input, e.getMessage());
                // throw an exception. This is a breaking change compared to pre 7.16.0
                // Workaround: fix the syntax!
                throw new IllegalArgumentException(message);
            }
        }

        // Defines the filtering methods supported by the filter.
        // Can be overridden by child classes to customize filtering.
        public abstract Set<String> filteringMethods();

        // Defines the usage message for the filter. This is used for logging purposes when the filter syntax is incorrect.
        public abstract String usageMessage();

        private void doParse() {
            Set<String> filteringMethods = filteringMethods();
            for (String filter : input.split(";")) {
                filter = filter.trim();
                String[] filterStrs = filter.split(":");
                if (filterStrs.length != 2) { // only support filter with : at the moment
                    throw new IllegalArgumentException("filter with no value not supported :[" + filter + "]");
                } else {

View on GitHub (pinned to fcec517be3)

Solutions

  1. Read the usage portion of the message — it states the exact accepted forms (e.g. FILTER must be `operationId:name1|name2` / `method:get|post` / `tag:t1|t2` / `path:/v1|/v2`).
  2. Fix the reported Input segment to use exactly one ':' per filter, '|' between values, ';' between filters.
  3. Quote the whole option in the shell so ';', '|' are not interpreted by the shell.
  4. If the filter is optional, remove the rule entirely instead of leaving a malformed stub.

Example fix

# before
--openapi-normalizer FILTER=operationId getPet|addPet
# after
--openapi-normalizer "FILTER=operationId:getPet|addPet"
Defensive patterns

Strategy: validation

Validate before calling

// Validate normalizer filter syntax before passing it to the generator
private static final Pattern SEGMENT = Pattern.compile("^\\s*([A-Za-z]+)\\s*:[^:]*$", Pattern.UNICODE_CHARACTER_CLASS);
boolean valid(String filterValue) {
    for (String seg : filterValue.split(";")) {
        if (!SEGMENT.matcher(seg).matches()) return false;
    }
    return true;
}

Try / catch

Catch IllegalArgumentException at startup around generation config; fail fast with the usage message shown to the operator. Do not swallow — since 7.16.0 bad syntax is intentionally fatal.

Prevention

When it happens

Trigger: Passing --openapi-normalizer 'FILTER=operationId' (no colon), 'SECURITY_SCHEMES_FILTER=key petstore' (no colon), or any value whose segments violate the `name:value1|value2;name2:value3` grammar. Empty input returns false without error; only non-empty malformed input throws.

Common situations: Upgrading to >= 7.16.0 where a previously-ignored bad FILTER string now crashes builds; shell quoting mistakes (unquoted ; or | interpreted by the shell); CI configuration templates with placeholder filter values never filled in.

Related errors


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