oracle/graal · error · IllegalArgumentException

Annotation enum element type %s has no host class

Error message

Annotation enum element type %s has no host class

What it means

Error "Annotation enum element type %s has no host class" thrown in oracle/graal.

Source

Thrown at compiler/src/jdk.graal.compiler.vmaccess/src/jdk/graal/compiler/vmaccess/HostAnnotationValueConverter.java:168

                    return element;
                }
                Array.set(array, i, element);
            }
            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

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the condition reported by the error: Annotation enum element type {} has no host class
  2. 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: Annotation enum element type {} has no host class

When it happens

Trigger: Thrown at compiler/src/jdk.graal.compiler.vmaccess/src/jdk/graal/compiler/vmaccess/HostAnnotationValueConverter.java:168 when the library encounters an invalid state.

Common situations: Occurs when a caller violates the contract guarded by this check: Annotation enum element type {} has no host class


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