{"record":{"id":"b9453e8882266372","repo":"oracle/graal","slug":"espresso-vmaccess-cannot-be-built-because-the-poly","errorCode":null,"errorMessage":"Espresso VMAccess cannot be built because the Polyglot engine does not expose the 'java' language. Check that the Espresso language is installed and visible on the module path.","messagePattern":"Espresso VMAccess cannot be built because the Polyglot engine does not expose the 'java' language\\. Check that the Espresso language is installed and visible on the module path\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalVMAccessBuilder.java","lineNumber":258,"sourceCode":"                } else if (engine.getInstruments().containsKey(group)) {\n                    descriptors = engine.getInstruments().get(group).getOptions();\n                }\n                break;\n        }\n        if (descriptors == null) {\n            return null;\n        }\n        return descriptors.get(key);\n    }\n\n    /**\n     * Fail before processing {@code java.*} options when Espresso is not available to the temporary\n     * engine. Otherwise missing Espresso dependencies surface later as a generic\n     * unrecognized-option error for the first {@code java.*} option.\n     */\n    private static void ensureJavaLanguageAvailable() {\n        if (!getTempEngine().getLanguages().containsKey(JAVA_LANGUAGE_ID)) {\n            throw new IllegalStateException(\"Espresso VMAccess cannot be built because the Polyglot engine does not expose the '\" + JAVA_LANGUAGE_ID +\n                            \"' language. Check that the Espresso language is installed and visible on the module path.\");\n        }\n    }\n\n    private static Engine getTempEngine() {\n        if (tempEngine == null) {\n            tempEngine = Engine.newBuilder().useSystemProperties(false).//\n                            out(OutputStream.nullOutputStream()).//\n                            err(OutputStream.nullOutputStream()).//\n                            option(\"engine.WarnInterpreterOnly\", \"false\").//\n                            build();\n        }\n        return tempEngine;\n    }\n\n    private static final class ModuleAccess {\n        static {\n            ModuleSupport.addExports(\"jdk.internal.vm.ci.espresso\", \"jdk.internal.vm.ci\",","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalVMAccessBuilder.java#L240-L276","documentation":"IllegalStateException thrown by EspressoExternalVMAccessBuilder.ensureJavaLanguageAvailable(): before processing java.* options, the builder starts a temporary Polyglot Engine and checks that a language with id 'java' (Espresso) is registered. If Espresso is not on the class/module path, this fails fast with a clear message instead of a confusing unrecognized-option error later.","triggerScenarios":"Building EspressoExternalVMAccess when the truffle-espresso language jar (with its language registration) is not on the application's classpath/module path, or when a custom Truffle language setup excludes it; also when a shading/relocation stripped the META-INF/services language registration.","commonSituations":"Maven/Gradle dependency marked 'provided' or pruned by the resolver; fat-jar shading dropping META-INF/services/com.oracle.truffle.api.TruffleLanguage; running on a JDK without the GraalVM module layout; mixing incompatible GraalVM SDK and Espresso versions so the language never registers.","solutions":["Add the Espresso implementation dependency (com.oracle.truffle:truffle-espresso / truffle language jar) to the runtime classpath or module path","If shading, merge META-INF/services resource files (e.g. maven-shade ServicesResourceTransformer) so the TruffleLanguage registration survives","Check for GraalVM version alignment: the SDK in truffle-api and the Espresso build must come from the same release"],"exampleFix":"// before (gradle): espresso marked provided -> language missing at runtime\n// after\ndependencies { implementation \"org.graalvm.polyglot:espresso-community:<same-version-as-polyglot>\" }\n\n// pre-flight check\nif (!Engine.newBuilder().build().getLanguages().containsKey(\"java\")) {\n    throw new IllegalStateException(\"Espresso language not on classpath\");\n}","handlingStrategy":"validation","validationCode":"try (Engine probe = Engine.newBuilder().useSystemProperties(false).build()) {\n    if (!probe.getLanguages().containsKey(\"java\")) {\n        throw new IllegalStateException(\"Espresso language missing from classpath/module path\");\n    }\n}","typeGuard":null,"tryCatchPattern":"catch (IllegalStateException e) { instruct: add the Espresso runtime dependency / fix shading; list detected languages }","preventionTips":["Pin truffle-api, polyglot, and espresso artifacts to the same GraalVM version","When building fat jars, merge META-INF/services (shade ServicesResourceTransformer) and smoke-test Engine language discovery in CI"],"tags":["espresso","classpath","module-path","polyglot","packaging"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}