{"record":{"id":"d1549e72c9fbe5a1","repo":"oracle/graal","slug":"expected-enum-annotation-array-element-got","errorCode":null,"errorMessage":"Expected enum annotation array element, got {}","messagePattern":"Expected enum annotation array element, got (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java","lineNumber":765,"sourceCode":"     * member-level exception proxy required by the JDK annotation handler.\n     */\n    private JavaConstant guestArrayValue(List<?> values, JavaType expectedType, JavaConstant annotationClass, JavaConstant memberName) {\n        if (!(expectedType instanceof ResolvedJavaType arrayType) || !arrayType.isArray()) {\n            throw new IllegalArgumentException(\"Expected array annotation member type, got \" + expectedType);\n        }\n        ResolvedJavaType componentType = arrayType.getComponentType();\n        for (Object value : values) {\n            if (value instanceof ErrorElement) {\n                return toGuestAnnotationMemberValue(value, componentType, true, annotationClass, memberName);\n            }\n        }\n        if (componentType.isEnum()) {\n            JavaConstant enumClass = access.getProviders().getConstantReflection().asJavaClass(componentType);\n            ResolvedJavaType stringType = access.getProviders().getMetaAccess().lookupJavaType(String.class);\n            JavaConstant[] constantNames = new JavaConstant[values.size()];\n            for (int i = 0; i < values.size(); i++) {\n                if (!(values.get(i) instanceof EnumElement enumElement)) {\n                    throw new IllegalArgumentException(\"Expected enum annotation array element, got \" + values.get(i));\n                }\n                if (!componentType.equals(enumElement.enumType)) {\n                    throw new IllegalArgumentException(\"Unexpected enum type: \" + enumElement.enumType.toJavaName());\n                }\n                constantNames[i] = access.getProviders().getConstantReflection().forString(enumElement.name);\n            }\n            JavaConstant namesArray = access.asArrayConstant(stringType, constantNames);\n            return access.invoke(access.com_oracle_truffle_espresso_vmaccess_guest_GuestAnnotationProxyBuilder_enumArray, null, enumClass, namesArray);\n        }\n        JavaConstant[] elements = new JavaConstant[values.size()];\n        for (int i = 0; i < values.size(); i++) {\n            elements[i] = toGuestAnnotationMemberValue(values.get(i), componentType, true, annotationClass, memberName);\n        }\n        return access.asArrayConstant(componentType, elements);\n    }\n\n    // Guest -> Host\n    private MethodHandle getArgumentFilter(JavaType guestType, ResolvedJavaType accessingClass, Class<?> hostType) {","sourceCodeStart":747,"sourceCodeEnd":783,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java#L747-L783","documentation":"Error \"Expected enum annotation array element, got {}\" thrown in oracle/graal.","triggerScenarios":"Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java:765 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: Expected enum annotation array element, got {}","solutions":["Fix the condition reported by the error: Expected enum annotation array element, got {}","Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call."],"exampleFix":"Validate inputs and environment so that the failing condition does not occur: Expected enum annotation array element, got {}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}