oracle/graal · error · IllegalArgumentException

CrashAtThrowsOOME and CrashAtIsFatal cannot both be enabled

Error message

CrashAtThrowsOOME and CrashAtIsFatal cannot both be enabled

What it means

initializeOptions rejects an option combination: CrashAtThrowsOOME=true together with CrashAtIsFatal != 0 is contradictory (one makes crashing methods throw OutOfMemoryError for testing, the other makes the crash fatal), so IllegalArgumentException is thrown at Graal option initialization before any compilation.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotGraalOptionValues.java:153

            }
            OptionsParser.parseOptions(compilerOptionSettings, compilerOptionValues, descriptors);
            return compilerOptionValues;
        }
    }

    private static String stripPrefix(String name, String prefix) {
        String baseName = name.substring(prefix.length());
        if (baseName.isEmpty()) {
            throw new IllegalArgumentException("Option name must follow '" + prefix + "' prefix");
        }
        return baseName;
    }

    private static OptionValues initializeOptions() {
        EconomicMap<OptionKey<?>, Object> values = parseOptions();
        OptionValues options = new OptionValues(values);
        if (HotSpotGraalCompiler.Options.CrashAtThrowsOOME.getValue(options) && HotSpotGraalCompiler.Options.CrashAtIsFatal.getValue(options) != 0) {
            throw new IllegalArgumentException("CrashAtThrowsOOME and CrashAtIsFatal cannot both be enabled");
        }
        return options;
    }

    static void printProperties(OptionValues compilerOptions, PrintStream out) {
        boolean all = HotSpotGraalCompilerFactory.Options.PrintPropertiesAll.getValue(compilerOptions);
        compilerOptions.printHelp(OptionsParser.getOptionsLoader(), out, GRAAL_OPTION_PROPERTY_PREFIX, all);
        LibGraalSupport libgraal = LibGraalSupport.INSTANCE;
        if (all && libgraal != null) {
            libgraal.printOptions(out, LIBGRAAL_VM_OPTION_PROPERTY_PREFIX);
        }
    }
}

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Choose one crash behavior: keep CrashAtThrowsOOME=true and drop CrashAtIsFatal (leave it 0/unset), or the reverse
  2. Audit generated command lines for stale crash-injection flags before enabling Graal

Example fix

# before
-Dgraal.CrashAtThrowsOOME=true -Dgraal.CrashAtIsFatal=1

# after
-Dgraal.CrashAtThrowsOOME=true
Defensive patterns

Strategy: validation

Validate before calling

boolean crashOptsConsistent(boolean throwsOome, int isFatal) { return !(throwsOome && isFatal != 0); }

Prevention

When it happens

Trigger: Setting both -Dgraal.CrashAtThrowsOOME=true and -Dgraal.CrashAtIsFatal=<nonzero> (e.g. 1) on the command line or via per-method options; evaluated once when HotSpotGraalOptionValues.initializeOptions builds the OptionValues.

Common situations: Test/fuzzing harnesses accumulating crash-injection flags over time; copying a diagnostics recipe that combined both options; CI defaults left over from an experiment.

Related errors


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