oracle/graal · error · IllegalArgumentException
Expected guest annotation object, got {}
Error message
Expected guest annotation object, got {} What it means
Error "Expected guest annotation object, got {}" thrown in oracle/graal.
Source
Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java:634
}
/**
* Converts an {@link AnnotationValue} returned by a host method into a guest-owned annotation
* compatible with the guest method's declared return type.
*/
@SuppressWarnings("unused")
private Value annotationValueAsGuestAnnotation(ResolvedJavaType expectedAnnotationType, AnnotationValue annotationValue) {
if (annotationValue == null) {
return null;
}
if (annotationValue.isError()) {
throw annotationValue.getError();
}
ResolvedJavaType actualAnnotationType = annotationValue.getAnnotationType();
validateAnnotationType(expectedAnnotationType, actualAnnotationType, "guest return type");
JavaConstant annotationConstant = Objects.requireNonNull(createGuestAnnotation(annotationValue));
if (!(annotationConstant instanceof EspressoExternalObjectConstant objectConstant)) {
throw new IllegalArgumentException("Expected guest annotation object, got " + annotationConstant);
}
return objectConstant.getValue();
}
/**
* Verifies that an annotation value names an annotation interface assignable to the declared
* guest type.
*/
private static void validateAnnotationType(ResolvedJavaType expectedAnnotationType, ResolvedJavaType actualAnnotationType, String expectedTypeDescription) {
if (!actualAnnotationType.isAnnotation()) {
throw new IllegalArgumentException("Annotation value type " + actualAnnotationType.toJavaName() + " is not an annotation interface");
}
if (!expectedAnnotationType.isAssignableFrom(actualAnnotationType)) {
throw new IllegalArgumentException(
"Annotation value type " + actualAnnotationType.toJavaName() + " is not assignable to " + expectedTypeDescription + " " + expectedAnnotationType.toJavaName());
}
}
View on GitHub (pinned to a66e9ccd1d)
Solutions
- Fix the condition reported by the error: Expected guest annotation object, got {}
- 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: Expected guest annotation object, got {} When it happens
Trigger: Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java:634 when the library encounters an invalid state.
Common situations: Occurs when a caller violates the contract guarded by this check: Expected guest annotation object, got {}
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/3ba7115164b86b45.
Report an issue: GitHub.