oracle/graal · error · IllegalArgumentException
Unexpected enum type: %s
Error message
Unexpected enum type: %s
What it means
Error "Unexpected enum type: %s" thrown in oracle/graal.
Source
Thrown at compiler/src/jdk.graal.compiler.vmaccess/src/jdk/graal/compiler/vmaccess/HostAnnotationValueConverter.java:171
}
return array;
}
if (targetType == Class.class) {
ResolvedJavaType classType = (ResolvedJavaType) value;
Class<?> clazz = typeToClass.apply(classType);
if (clazz == null) {
throw new IllegalArgumentException("Annotation class element type " + classType.toJavaName() + " has no host class");
}
return clazz;
}
if (targetType.isEnum()) {
EnumElement enumElement = (EnumElement) value;
Class<?> enumType = typeToClass.apply(enumElement.enumType);
if (enumType == null) {
throw new IllegalArgumentException("Annotation enum element type " + enumElement.enumType.toJavaName() + " has no host class");
}
if (enumType != targetType) {
throw new IllegalArgumentException("Unexpected enum type: " + enumType.getName());
}
try {
return Enum.valueOf((Class<? extends Enum>) enumType.asSubclass(Enum.class), enumElement.name);
} catch (IllegalArgumentException e) {
return new EnumConstantNotPresentExceptionProxy((Class<? extends Enum<?>>) enumType, enumElement.name);
}
}
if (targetType.isAnnotation()) {
return toAnnotation((AnnotationValue) value, targetType.asSubclass(Annotation.class), typeToClass);
}
return value;
}
/**
* Accessible replacement for the JDK's package-private
* {@code AnnotationTypeMismatchExceptionProxy}. The JDK annotation invocation handler calls
* {@link #generateException()} only when the affected member is accessed.
*/View on GitHub (pinned to a66e9ccd1d)
Solutions
- Fix the condition reported by the error: Unexpected enum type: {}
- Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call.
Example fix
Validate inputs and environment so that the failing condition does not occur: Unexpected enum type: {} When it happens
Trigger: Thrown at compiler/src/jdk.graal.compiler.vmaccess/src/jdk/graal/compiler/vmaccess/HostAnnotationValueConverter.java:171 when the library encounters an invalid state.
Common situations: Occurs when a caller violates the contract guarded by this check: Unexpected enum type: {}
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/99a6bfaef00f47b6.
Report an issue: GitHub.