oracle/graal · error · IllegalArgumentException

Method compatible with {} not found in class {}

Error message

Method compatible with {} not found in class {}

What it means

Error "Method compatible with {} not found in class {}" thrown in oracle/graal.

Source

Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalHostProxies.java:516

        JavaType guestReturnType = method.getSignature().getReturnType(null);
        for (Method hostMethodCandidate : hostClass.getMethods()) {
            if (!hostMethodCandidate.getName().equals(method.getName())) {
                continue;
            }
            if (!argumentsCompatible(method, hostMethodCandidate.getParameterTypes())) {
                continue;
            }
            if (!typesCompatible(guestReturnType, method.getDeclaringClass(), hostMethodCandidate.getReturnType())) {
                continue;
            }
            if (hostMethod == null) {
                hostMethod = hostMethodCandidate;
            } else {
                throw new RuntimeException("Unimplemented: most specific mapping: " + hostMethod + " vs. " + hostMethodCandidate);
            }
        }
        if (hostMethod == null && !method.isDefault()) {
            throw new IllegalArgumentException("Method compatible with " + method.format("%r %h.%n(%p)") + " not found in class " + hostClass.getName());
        }
        return hostMethod;
    }

    private boolean argumentsCompatible(ResolvedJavaMethod method, Class<?>[] hostParameterTypes) {
        Signature guestSignature = method.getSignature();
        int parameterCount = guestSignature.getParameterCount(false);
        if (hostParameterTypes.length != parameterCount) {
            return false;
        }
        for (int i = 0; i < parameterCount; i++) {
            JavaType guestParameterType = guestSignature.getParameterType(i, null);
            Class<?> hostParameterType = hostParameterTypes[i];
            if (!typesCompatible(guestParameterType, method.getDeclaringClass(), hostParameterType)) {
                return false;
            }
        }
        return true;

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the condition reported by the error: Method compatible with {} not found in class {}
  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: Method compatible with {} not found in class {}

When it happens

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

Common situations: Occurs when a caller violates the contract guarded by this check: Method compatible with {} not found in class {}


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