oracle/graal · critical · IllegalArgumentException

%s is not an enum type

Error message

%s is not an enum type

What it means

JNIExceptionWrapper needs its host-side entry-points class (org.graalvm.jniutils.JNIExceptionWrapperEntryPoints) loaded through JNI FindClass, first via the JVMCI classloader. If every lookup path fails and no pending JNI exception can be reported, it clears the exception and throws InternalError: the infrastructure class itself could not be loaded, so exception wrapping is impossible. This is a classloading/configuration failure in the embedded JVM setup.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/annotation/EnumElement.java:52

     * The type of the enum.
     */
    public final ResolvedJavaType enumType;

    /**
     * The name of the enum constants.
     */
    public final String name;

    /**
     * Creates an enum constant.
     *
     * @param enumType the {@linkplain Enum enum type}
     * @param name the {@linkplain Enum#name() name} of the enum
     * @throws IllegalArgumentException if {@code enumType} is not an enum type
     */
    public EnumElement(ResolvedJavaType enumType, String name) {
        if (!enumType.isEnum()) {
            throw new IllegalArgumentException(enumType.toClassName() + " is not an enum type");
        }
        this.enumType = enumType;
        this.name = name;
    }

    @Override
    public String toString() {
        return name;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof EnumElement that) {
            return this.enumType.equals(that.enumType) && this.name.equals(that.name);
        }
        return false;
    }

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Ensure the org.graalvm.jniutils artifact (correct version) is on the class path of the host VM used by JVMCI.
  2. Remove shading/relocation rules that rewrite org.graalvm.jniutils class names, or add them as exclusions.
  3. Deduplicate GraalVM SDK jars (mvn dependency:tree / classpath inspection) so a single consistent version loads.
Defensive patterns

Strategy: fallback

Validate before calling

try {
    Class.forName("org.graalvm.jniutils.JNIExceptionWrapperEntryPoints", false, jvmciClassLoader);
} catch (ClassNotFoundException e) {
    throw new IllegalStateException("jniutils jar missing from host classpath", e);
}

Prevention

When it happens

Trigger: org.graalvm.jniutils jar missing from the class path visible to the host JVMCI classloader; classloader delegation hiding the class; a NoClassDefFoundError during static init of the entry-points class that was swallowed by ExceptionClear; severe classpath conflicts in an embedded Espresso/libgraal setup.

Common situations: Shading/relocating the jniutils jar so the binary name no longer resolves; running native-image/Espresso with a partial class path; duplicate incompatible copies of the SDK on the classpath.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/cef283e25d928742. Report an issue: GitHub.