oracle/graal · error · IllegalArgumentException

Expected an EspressoExternalResolvedJavaMethod, got

Error message

Expected an EspressoExternalResolvedJavaMethod, got 

What it means

Error "Expected an EspressoExternalResolvedJavaMethod, got " thrown in oracle/graal.

Source

Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalVMAccess.java:728

             * this guest reflection object.
             */
            ResolvedJavaType declaringRecord = EspressoExternalConstantReflectionProvider.classAsType(value.invokeMember("getDeclaringRecord"), this);
            String name = value.invokeMember("getName").asString();
            ResolvedJavaType type = EspressoExternalConstantReflectionProvider.classAsType(value.invokeMember("getType"), this);
            for (ResolvedJavaRecordComponent component : declaringRecord.getRecordComponents()) {
                if (component.getName().equals(name) && component.getType().equals(type)) {
                    return component;
                }
            }
            throw new JVMCIError("unresolved RecordComponent %s", value);
        }
        return null;
    }

    @Override
    public JavaConstant asFieldConstant(ResolvedJavaField field) {
        if (!(field instanceof EspressoExternalResolvedJavaField espressoField)) {
            throw new IllegalArgumentException("Expected an EspressoExternalResolvedJavaMethod, got " + safeGetClass(field));
        }
        if (field.isInternal()) {
            return null;
        }
        Value value = espressoField.getReflectFieldMirror();
        if (value.isNull()) {
            return null;
        }
        return new EspressoExternalObjectConstant(this, value);
    }

    @Override
    public JavaConstant asExecutableConstant(ResolvedJavaMethod method) {
        if (!(method instanceof EspressoExternalResolvedJavaMethod espressoMethod)) {
            throw new IllegalArgumentException("Expected an EspressoExternalResolvedJavaMethod, got " + safeGetClass(method));
        }
        if (espressoMethod.isClassInitializer()) {
            return null;

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the condition reported by the error: Expected an EspressoExternalResolvedJavaMethod, got
  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: Expected an EspressoExternalResolvedJavaMethod, got

When it happens

Trigger: Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalVMAccess.java:728 when the library encounters an invalid state.

Common situations: Occurs when a caller violates the contract guarded by this check: Expected an EspressoExternalResolvedJavaMethod, got


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