oracle/graal · error · IllegalArgumentException

The "%s" is not a valid performance warning kind. Valid valu

Error message

The "%s" is not a valid performance warning kind. Valid values are%n

What it means

PerformanceWarnings.parse splits a comma-separated option value and resolves each token through PerformanceWarningKind.forName (plus 'all'/'none' sentinels). An unknown token produces IllegalArgumentException with the offending name followed by the full list of valid kinds, each with its help text.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/truffle/TruffleCompilerOptions.java:113

                for (String name : value.split(",")) {
                    if ("bailout".equals(name)) {
                        /*
                         * The PerformanceWarningKind.BAILOUT was removed but 'bailout' can still
                         * appear in option value due to backward compatibility. We need to ignore
                         * the 'bailout' option value.
                         */
                        continue;
                    }
                    try {
                        result.add(PerformanceWarningKind.forName(name));
                    } catch (IllegalArgumentException e) {
                        String message = String.format("The \"%s\" is not a valid performance warning kind. Valid values are%n", name);
                        for (PerformanceWarningKind kind : PerformanceWarningKind.values()) {
                            message = message + String.format("%s%s%s%n", kind.name, indent(kind.name.length()), kind.help);
                        }
                        message = message + String.format("all%sEnables all performance warnings%n", indent(3));
                        message = message + String.format("none%sDisables performance warnings%n", indent(4));
                        throw new IllegalArgumentException(message);
                    }
                }
                return result;
            }
        }

    }

    public record CompilationTiers(Set<CompilationTier> tiers) {

        public static CompilationTiers defaultValue() {
            return new CompilationTiers(Set.of());
        }

        public static CompilationTiers parse(String s) {
            return new CompilationTiers(parseImpl(s));
        }

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Read the valid names from the exception message itself (it enumerates every kind with help text) and correct the token.
  2. Use 'all' to enable everything, 'none' to disable, and exact comma-separated kind names otherwise.
  3. After upgrading GraalVM, re-check the kind list; kinds are added/renamed between releases.

Example fix

# before
-Dgraal.TrufflePerformanceWarnings=partialEscape,invalideName

# after
-Dgraal.TrufflePerformanceWarnings=partialEscape,all-invalidations
Defensive patterns

Strategy: validation

Validate before calling

static boolean isValidWarningKind(String token) {
    if (token.equals("all") || token.equals("none")) {
        return true;
    }
    return java.util.Arrays.stream(PerformanceWarningKind.values())
            .anyMatch(k -> k.name.equals(token));
}
for (String token : requested.split(",")) {
    if (!isValidWarningKind(token.trim())) {
        throw new IllegalArgumentException("Invalid performance warning kind: " + token);
    }
}

Prevention

When it happens

Trigger: Passing a performance-warnings option containing a token that is not a PerformanceWarningKind name, not 'all', and not 'none' — typo, old name from a previous release, or wrong casing.

Common situations: Enabling Truffle performance warnings via option strings copied from stale documentation; upgrading a release that renamed a warning kind.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/d446111e696c8690. Report an issue: GitHub.