oracle/graal · error · IllegalArgumentException
LIRInstructionVerifierPath is not supported in native image
Error message
LIRInstructionVerifierPath is not supported in native image
What it means
The LIR instruction verifier (enabled via the LIRInstructionVerifierPath option) loads verifier classes through a URLClassLoader, which is excluded from native images because of the image-size cost. If compilation code runs inside a native-image runtime (NativeImageSupport.inRuntimeCode()) and the option is set, this factory throws IllegalArgumentException. Outside native images, the same option is legal and lazily initializes the verifiers under a lock.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/asm/CompilationResultBuilderFactory.java:112
}
@Override
public CompilationResultBuilder createBuilder(CoreProviders providers,
FrameMap frameMap,
Assembler<?> asm,
DataBuilder dataBuilder,
FrameContext frameContext,
OptionValues options,
DebugContext debug,
CompilationResult compilationResult,
Register uncompressedNullRegister,
LIR lir) {
String lirInstructionVerifierPath = Options.LIRInstructionVerifierPath.getValue(options);
if (NativeImageSupport.inRuntimeCode()) {
if (lirInstructionVerifierPath != null) {
// LIR instruction verifier uses URLClassLoader which is excluded from
// native images due to the image size increase it causes.
throw new IllegalArgumentException(Options.LIRInstructionVerifierPath.getName() + " is not supported in native image");
}
} else if (!isVerifierInitialized) {
synchronized (lirInstructionVerifiers) {
if (!isVerifierInitialized) {
if (lirInstructionVerifierPath != null && !lirInstructionVerifierPath.isEmpty()) {
initializeLIRVerifiers(lirInstructionVerifierPath);
}
isVerifierInitialized = true;
}
}
}
return new CompilationResultBuilder(providers,
frameMap,
asm,
dataBuilder,
frameContext,
options,
debug,View on GitHub (pinned to a66e9ccd1d)
Solutions
- Remove/unset the LIRInstructionVerifierPath option when running the compiler inside a native image
- Scope the flag to JVM-mode runs only, e.g., guard your launcher script on whether the runtime is a native image
- If you need LIR verification, run the same compilation on the JVM (non-native compiler) where URLClassLoader is available
Example fix
# before native-image -R:graal.LIRInstructionVerifierPath=/verifiers ... # or running a native compiler with the flag # after native-image ... # option removed; verifier runs only in JVM mode: java -Dgraal.LIRInstructionVerifierPath=/verifiers ...
Defensive patterns
Strategy: validation
Validate before calling
// Before launching the compiler, drop options unsupported in native images
if (System.getProperty("org.graalvm.nativeimage.kind") != null) { // native runtime detected
clearOption("graal.LIRInstructionVerifierPath");
} Prevention
- Keep flag sets per-runtime: JVM tuning flags and native-image flags in separate profiles
- Read option docs for the 'not supported in native image' notes before reusing flags
- Run LIR verification only in JVM-mode test jobs
When it happens
Trigger: Setting -Dgraal.LIRInstructionVerifierPath=<path> (or the substratevm equivalent option) on a command line or image-build configuration that runs Graal compilation inside a natively built compiler, e.g., a native-image-compiled compiler (SVM-hosted compilation, libgraal or a native truffle compiler).
Common situations: Carrying a set of tuning flags from JVM-mode debugging (where the verifier works) into a native-image build or a GraalVM edition whose compiler runs natively; CI configs that enable the verifier globally regardless of runtime.
Related errors
- invalid double value: "%s"
- no choice named '%s'
- Option setting has does not match the pattern <name>=<value>
- Delimiter '%s' is repeated contiguously in "%s"
- Could not find option %s (alternates: Option PrintGraphFile
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/98ff5beab6ef1003.
Report an issue: GitHub.