{"record":{"id":"98ff5beab6ef1003","repo":"oracle/graal","slug":"lirinstructionverifierpath-is-not-supported-in-nat","errorCode":null,"errorMessage":"LIRInstructionVerifierPath is not supported in native image","messagePattern":"LIRInstructionVerifierPath is not supported in native image","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/asm/CompilationResultBuilderFactory.java","lineNumber":112,"sourceCode":"        }\n\n        @Override\n        public CompilationResultBuilder createBuilder(CoreProviders providers,\n                        FrameMap frameMap,\n                        Assembler<?> asm,\n                        DataBuilder dataBuilder,\n                        FrameContext frameContext,\n                        OptionValues options,\n                        DebugContext debug,\n                        CompilationResult compilationResult,\n                        Register uncompressedNullRegister,\n                        LIR lir) {\n            String lirInstructionVerifierPath = Options.LIRInstructionVerifierPath.getValue(options);\n            if (NativeImageSupport.inRuntimeCode()) {\n                if (lirInstructionVerifierPath != null) {\n                    // LIR instruction verifier uses URLClassLoader which is excluded from\n                    // native images due to the image size increase it causes.\n                    throw new IllegalArgumentException(Options.LIRInstructionVerifierPath.getName() + \" is not supported in native image\");\n                }\n            } else if (!isVerifierInitialized) {\n                synchronized (lirInstructionVerifiers) {\n                    if (!isVerifierInitialized) {\n                        if (lirInstructionVerifierPath != null && !lirInstructionVerifierPath.isEmpty()) {\n                            initializeLIRVerifiers(lirInstructionVerifierPath);\n                        }\n                        isVerifierInitialized = true;\n                    }\n                }\n            }\n            return new CompilationResultBuilder(providers,\n                            frameMap,\n                            asm,\n                            dataBuilder,\n                            frameContext,\n                            options,\n                            debug,","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/asm/CompilationResultBuilderFactory.java#L94-L130","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\nnative-image -R:graal.LIRInstructionVerifierPath=/verifiers ... # or running a native compiler with the flag\n\n# after\nnative-image ... # option removed; verifier runs only in JVM mode:\njava -Dgraal.LIRInstructionVerifierPath=/verifiers ...","handlingStrategy":"validation","validationCode":"// Before launching the compiler, drop options unsupported in native images\nif (System.getProperty(\"org.graalvm.nativeimage.kind\") != null) { // native runtime detected\n    clearOption(\"graal.LIRInstructionVerifierPath\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["graalvm","native-image","lir-verifier","options","configuration"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}