{"record":{"id":"b59c8968c47ba505","repo":"oracle/graal","slug":"annotation-value-type-is-not-assignable-to","errorCode":null,"errorMessage":"Annotation value type {} is not assignable to {} {}","messagePattern":"Annotation value type (.+?) is not assignable to (.+?) (.+?)","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":648,"sourceCode":"        ResolvedJavaType actualAnnotationType = annotationValue.getAnnotationType();\n        validateAnnotationType(expectedAnnotationType, actualAnnotationType, \"guest return type\");\n        JavaConstant annotationConstant = Objects.requireNonNull(createGuestAnnotation(annotationValue));\n        if (!(annotationConstant instanceof EspressoExternalObjectConstant objectConstant)) {\n            throw new IllegalArgumentException(\"Expected guest annotation object, got \" + annotationConstant);\n        }\n        return objectConstant.getValue();\n    }\n\n    /**\n     * Verifies that an annotation value names an annotation interface assignable to the declared\n     * guest type.\n     */\n    private static void validateAnnotationType(ResolvedJavaType expectedAnnotationType, ResolvedJavaType actualAnnotationType, String expectedTypeDescription) {\n        if (!actualAnnotationType.isAnnotation()) {\n            throw new IllegalArgumentException(\"Annotation value type \" + actualAnnotationType.toJavaName() + \" is not an annotation interface\");\n        }\n        if (!expectedAnnotationType.isAssignableFrom(actualAnnotationType)) {\n            throw new IllegalArgumentException(\n                            \"Annotation value type \" + actualAnnotationType.toJavaName() + \" is not assignable to \" + expectedTypeDescription + \" \" + expectedAnnotationType.toJavaName());\n        }\n    }\n\n    /**\n     * Materializes a guest-owned JDK annotation proxy from JVMCI annotation metadata. Explicit\n     * elements are validated, defaults are supplied from the guest annotation type, absent required\n     * members remain absent, and malformed members are represented by deferred guest exception\n     * proxies.\n     */\n    private JavaConstant createGuestAnnotation(AnnotationValue annotationValue) {\n        ResolvedJavaType actualAnnotationType = annotationValue.getAnnotationType();\n        JavaConstant annotationClass = access.getProviders().getConstantReflection().asJavaClass(actualAnnotationType);\n        JavaConstant elements = access.invoke(access.java_util_HashMap_init, null);\n        Map<String, Object> annotationElements = annotationValue.getElements();\n        AnnotationValueType annotationValueType = AnnotationValueType.getInstance(actualAnnotationType);\n        AnnotationValueValidation.validateElements(annotationValue, annotationValueType);\n        Map<String, Object> memberDefaults = annotationValueType.memberDefaults();","sourceCodeStart":630,"sourceCodeEnd":666,"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#L630-L666","documentation":"Error \"Annotation value type {} is not assignable to {} {}\" thrown in oracle/graal.","triggerScenarios":"Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java:648 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: Annotation value type {} is not assignable to {} {}","solutions":["Fix the condition reported by the error: Annotation value type {} is not assignable to {} {}","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: Annotation value type {} is not assignable to {} {}","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"}