oracle/graal · error · IllegalArgumentException

Unknown tier option value '%s'. %s

Error message

Unknown tier option value '%s'. %s

What it means

CompilationTier.parse converts an option string into the CompilationTier enum (lowTier, peTier, truffleTier) via valueOf; any other string raises IllegalArgumentException with 'Unknown tier option value' and the accepted values listed in EXPANSION_VALUES.

Source

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

    }

    @Override
    public String getNamePrefix() {
        return "compiler.";
    }

    //@formatter:off

    public enum CompilationTier {
        lowTier,
        peTier,
        truffleTier;

        static CompilationTier parse(String name) {
            try {
                return CompilationTier.valueOf(name);
            } catch (IllegalArgumentException e) {
                throw new IllegalArgumentException(String.format("Unknown tier option value '%s'. %s", name, EXPANSION_VALUES));
            }
        }
    }
    public record PerformanceWarnings(Set<PerformanceWarningKind> kinds) {

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

        public static PerformanceWarnings parse(String value) {
            return new PerformanceWarnings(parseImpl(value));
        }

        private static Set<PerformanceWarningKind> parseImpl(String value) {
            if ("none".equals(value)) {
                return EnumSet.noneOf(PerformanceWarningKind.class);
            } else if ("all".equals(value)) {
                Set<PerformanceWarningKind> result = EnumSet.allOf(PerformanceWarningKind.class);

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Use one of the exact enum names: lowTier, peTier, or truffleTier (case-sensitive).
  2. Check EXPANSION_VALUES in the error message for the authoritative list of this release.
  3. Validate tier strings against the enum before passing them in (see validation snippet).

Example fix

// before
options.put("graal.TruffleCompilationTier", "low-tier"); // invalid: hyphen and case

// after
options.put("graal.TruffleCompilationTier", "lowTier");
Defensive patterns

Strategy: validation

Validate before calling

static boolean isValidTier(String name) {
    return java.util.Set.of("lowTier", "peTier", "truffleTier").contains(name);
}
if (!isValidTier(tier)) {
    throw new IllegalArgumentException("Unknown tier '" + tier + "'; use lowTier, peTier or truffleTier");
}

Type guard

// Narrow an untrusted string to a CompilationTier before use
static java.util.Optional<CompilationTier> asTier(String s) {
    try {
        return java.util.Optional.of(CompilationTier.valueOf(s));
    } catch (IllegalArgumentException e) {
        return java.util.Optional.empty();
    }
}

Prevention

When it happens

Trigger: Setting a tier option (e.g. a truffle compilation-tier spec) to a string that isn't exactly one of the enum constants — wrong case, old name, or invented value.

Common situations: Carrying tier names over from a different GraalVM release where the enum changed; case mistakes ('LowTier'); copy-paste from outdated docs.

Related errors


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