{"record":{"id":"527ab6dd72e6b523","repo":"oracle/graal","slug":"jimage-mode-can-be-native-java","errorCode":null,"errorMessage":"JImage: Mode can be 'native', 'java'.","messagePattern":"JImage: Mode can be 'native', 'java'\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoOptions.java","lineNumber":694,"sourceCode":"\n    @Option(help = \"Use the host FinalReference to implement guest finalizers. If set to false, FinalReference will fallback to WeakReference semantics.\", //\n                    category = OptionCategory.EXPERT, //\n                    stability = OptionStability.EXPERIMENTAL, //\n                    usageSyntax = \"false|true\") //\n    public static final OptionKey<Boolean> UseHostFinalReference = new OptionKey<>(true);\n\n    public enum JImageMode {\n        NATIVE,\n        JAVA,\n    }\n\n    private static final OptionType<JImageMode> JIMAGE_MODE_OPTION_TYPE = new OptionType<>(\"JImageMode\", new Function<String, JImageMode>() {\n        @Override\n        public JImageMode apply(String s) {\n            try {\n                return JImageMode.valueOf(s.toUpperCase(Locale.ROOT));\n            } catch (IllegalArgumentException e) {\n                throw new IllegalArgumentException(\"JImage: Mode can be 'native', 'java'.\");\n            }\n        }\n    });\n\n    @Option(help = \"Selects the jimage reader.\", //\n                    category = OptionCategory.EXPERT, stability = OptionStability.EXPERIMENTAL) //\n    public static final OptionKey<JImageMode> JImage = new OptionKey<>(JImageMode.JAVA, JIMAGE_MODE_OPTION_TYPE);\n\n    @Option(help = \"Enables preview features.\", //\n                    category = OptionCategory.USER, //\n                    stability = OptionStability.STABLE, //\n                    usageSyntax = \"false|true\") //\n    public static final OptionKey<Boolean> EnablePreview = new OptionKey<>(false);\n\n    @Option(help = \"Enables the WhiteBox API.\", //\n                    category = OptionCategory.INTERNAL, //\n                    stability = OptionStability.EXPERIMENTAL, //\n                    usageSyntax = \"false|true\") //","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoOptions.java#L676-L712","documentation":"The converter for --java.JImage maps the string to JImageMode.NATIVE/JAVA via valueOf; anything other than 'native' or 'java' (case-insensitive) throws. The option selects whether the module image (modules file of the JDK) is read by a native implementation or a Java one.","triggerScenarios":"Passing --java.JImage=both, system, or default; any string that is not one of the two enum names.","commonSituations":"Experimenting with expert options; config files carried over from other JVM distributions with similarly named flags.","solutions":["Use --java.JImage=native or --java.JImage=java (default is java).","Omit the option unless you specifically need the native reader.","Check 'mx espresso' help output for current accepted values."],"exampleFix":"# before\n--java.JImage=system\n\n# after\n--java.JImage=native","handlingStrategy":"validation","validationCode":"if (!List.of(\"native\", \"java\").contains(mode.toLowerCase(Locale.ROOT))) throw new ConfigException(\"JImage mode must be native|java\");","typeGuard":"static boolean validJImageMode(String s) { return s != null && s.matches(\"(?i)(native|java)\"); }","tryCatchPattern":null,"preventionTips":["Omit the expert option unless specifically needed.","Re-check expert-option spellings on GraalVM upgrades."],"tags":["espresso","graalvm","configuration","jimage","options"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}