{"record":{"id":"2bc02afe7222e232","repo":"oracle/graal","slug":"unexpected-enum-type","errorCode":null,"errorMessage":"Unexpected enum type: {}","messagePattern":"Unexpected enum type: (.+?)","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":726,"sourceCode":"        };\n    }\n\n    /**\n     * Boxes a scalar primitive annotation member while leaving primitive array elements unboxed for\n     * guest array construction.\n     */\n    private JavaConstant primitiveAnnotationMemberValue(JavaConstant primitive, boolean arrayElement) {\n        return arrayElement ? primitive : access.getProviders().getConstantReflection().boxPrimitive(primitive);\n    }\n\n    /**\n     * Resolves an enum element in the guest context, preserving a missing constant as a deferred\n     * guest exception proxy.\n     */\n    private JavaConstant guestEnumValue(EnumElement enumElement, JavaType expectedType) {\n        ResolvedJavaType enumType = enumElement.enumType;\n        if (!(expectedType instanceof ResolvedJavaType expectedEnumType) || !expectedEnumType.equals(enumType)) {\n            throw new IllegalArgumentException(\"Unexpected enum type: \" + enumType.toJavaName());\n        }\n        JavaConstant enumClass = access.getProviders().getConstantReflection().asJavaClass(enumType);\n        JavaConstant enumName = access.getProviders().getConstantReflection().forString(enumElement.name);\n        return access.invoke(access.com_oracle_truffle_espresso_vmaccess_guest_GuestAnnotationProxyBuilder_enumValue, null, enumClass, enumName);\n    }\n\n    /**\n     * Converts a nested annotation value after verifying its concrete type against the enclosing\n     * member declaration.\n     */\n    private JavaConstant guestAnnotationValue(AnnotationValue annotationValue, JavaType expectedType) {\n        if (!(expectedType instanceof ResolvedJavaType expectedAnnotationType)) {\n            throw new IllegalArgumentException(\"Expected resolved annotation member type, got \" + expectedType);\n        }\n        validateAnnotationType(expectedAnnotationType, annotationValue.getAnnotationType(), \"annotation member type\");\n        return createGuestAnnotation(annotationValue);\n    }\n","sourceCodeStart":708,"sourceCodeEnd":744,"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#L708-L744","documentation":"Error \"Unexpected enum type: {}\" thrown in oracle/graal.","triggerScenarios":"Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java:726 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: Unexpected enum type: {}","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."],"exampleFix":"Validate inputs and environment so that the failing condition does not occur: Unexpected enum type: {}","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"}