{"record":{"id":"2318f15fe9d24e44","repo":"oracle/graal","slug":"s-missing-element-s","errorCode":null,"errorMessage":"%s missing element %s","messagePattern":"(.+?) missing element (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/annotation/AnnotationValue.java","lineNumber":197,"sourceCode":"    /// | Class      | ResolvedJavaType |\n    /// | Enum       | EnumElement      |\n    /// | Annotation | AnnotationValue  |\n    /// | T[]        | unmodifiable List<T> where `T` is one of the above types |\n    ///\n    /// @param <V> the type of the element as per the `AnnotationValue` column in the above\n    ///            table or [Object]\n    /// @param elementType the class for the type of the element or `Object.class`\n    /// @return the annotation element denoted by `name`\n    /// @throws ClassCastException if the element is not of type `elementType`\n    /// @throws IllegalArgumentException if this annotation has no element named `name`\n    ///            or if `elementType != Object.class` and the element is of type\n    ///            [ErrorElement]\n    // @formatter:on\n    public <V> V get(String name, Class<V> elementType) {\n        checkError();\n        Object val = elements.get(name);\n        if (val == null) {\n            throw new IllegalArgumentException(type.toJavaName() + \" missing element \" + name);\n        }\n        if (elementType != Object.class && val instanceof ErrorElement ee) {\n            throw ee.generateException();\n        }\n        return elementType.cast(val);\n    }\n\n    /**\n     * Gets the array element denoted by {@code name} as an unmodifiable list.\n     *\n     * @throws ClassCastException if the element is not an array, or it's a non-empty array whose\n     *             first element does not have type {@code componentType}\n     * @throws IllegalArgumentException if this annotation has no element named {@code name}\n     *\n     * @param <V> the component type of the array as per the {@code AnnotationValue} column in the\n     *            table {@linkplain #get(String, Class) here}\n     */\n    @SuppressWarnings(\"unchecked\")","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/annotation/AnnotationValue.java#L179-L215","documentation":"DefaultHomeFinder treats java.home as a GraalVM installation only if it contains lib/modules (the jimage file introduced by the JDK 9+ module system). If java.home exists but lib/modules is missing, the finder concludes this is not a module-image-based GraalVM home and throws an AssertionError naming the offending path. It is the structural check that separates a JDK 9+ layout from a plain JDK 8 JRE.","triggerScenarios":"Pointing java.home at a JDK 8 or earlier installation (no lib/modules); using a stripped runtime from which the modules image was removed; pointing at a build-output JDK directory that has not yet had its image assembled.","commonSituations":"Running GraalVM tooling that requires JDK 11+ while JAVA_HOME still targets JDK 8; using a JRE-style directory instead of a full image; partially downloaded or corrupted GraalVM distributions.","solutions":["Install and select a GraalVM or JDK 11+ distribution whose lib/modules exists, e.g. ls $JAVA_HOME/lib/modules to confirm.","Fix JAVA_HOME / java.home to point at the GraalVM installation root, not a subdirectory like bin or lib.","Re-download the GraalVM distribution if lib/modules is missing from the archive."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"Path jh = Paths.get(System.getProperty(\"java.home\", \"\"));\nif (!Files.isRegularFile(jh.resolve(Paths.get(\"lib\", \"modules\")))) {\n    throw new IllegalStateException(\"Not a JDK 9+/GraalVM home (no lib/modules): \" + jh);\n}\nHomeFinder.findHome();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on JDK 11+ / GraalVM distributions and verify lib/modules exists in CI setup scripts.","Point java.home at the JDK root, never at bin/ or a JDK 8 jre/ directory."],"tags":["environment","jdk-version","java-home","graalvm-sdk"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}