oracle/graal · critical · InternalError
No such method: %s
Error message
No such method: %s
What it means
FromLibGraalCalls.getJNIMethod looks up a host-side static method via JNI GetStaticMethodID using a method name and signature derived from a call id. If JNI returns a null JMethodID, no method with that exact name/signature exists on the peer class, and it throws InternalError('No such method: ' + methodName) after wrapping any pending JNI exception. This almost always indicates the libgraal image and the host JVM expose mismatched APIs.
Source
Thrown at compiler/src/jdk.graal.compiler.libgraal/src/jdk/graal/compiler/libgraal/truffle/FromLibGraalCalls.java:95
@SuppressWarnings("unchecked")
public final <R extends JObject> R callJObject(JNIEnv env, T id, JValue args) {
JNIMethodImpl<T> method = getJNIMethod(env, id, Object.class);
return hotSpotCalls.callStaticJObject(env, peer, method, args);
}
private JNIMethodImpl<T> getJNIMethod(JNIEnv env, T hcId, Class<?> expectedReturnType) {
assert hcId.getReturnType() == expectedReturnType || expectedReturnType.isAssignableFrom(hcId.getReturnType());
try {
return methods.computeIfAbsent(hcId, new Function<T, JNIMethodImpl<T>>() {
@Override
public JNIMethodImpl<T> apply(T id) {
JClass c = peer;
String methodName = id.getMethodName();
try (CCharPointerHolder name = CTypeConversion.toCString(methodName); CCharPointerHolder sig = CTypeConversion.toCString(id.getSignature())) {
JMethodID jniId = JNIUtil.GetStaticMethodID(env, c, name.get(), sig.get());
if (jniId.isNull()) {
throw new InternalError("No such method: " + methodName);
}
return new JNIMethodImpl<>(id, jniId);
}
}
});
} catch (InternalError ie) {
JNIExceptionWrapper.wrapAndThrowPendingJNIException(env);
throw ie;
}
}
/**
* Describes a method in HotSpot peer class}.
*/
private static final class JNIMethodImpl<T extends Enum<T> & FromLibGraalId> implements JNIMethod {
final T hcId;
final JMethodID jniId;
View on GitHub (pinned to a66e9ccd1d)
Solutions
- Ensure the libgraal image and the host JVM runtime come from the exact same GraalVM release.
- Rebuild the native libgraal image after any change to the interop/callback classes.
- Check for duplicate/stale copies of the peer class on the classpath (shadowed jars).
- Inspect the pending JNI exception (JNIExceptionWrapper surfaces it) to confirm the NoSuchMethodError target.
Defensive patterns
Strategy: fallback
Try / catch
try {
support.enterLibgraal(...);
} catch (InternalError e) {
if (e.getMessage() != null && e.getMessage().startsWith("No such method")) {
// peer API mismatch: verify both sides use the same GraalVM build, then restart
}
} Prevention
- Ship the libgraal image and host runtime from the same GraalVM release
- Rebuild the image after changing interop classes
- Check for shadowed/stale peer classes on the classpath
When it happens
Trigger: libgraal calling back into the host JVM for a method whose name or descriptor changed — e.g. a host class was compiled from a different GraalVM version, or a refactor renamed/overloaded the expected static method.
Common situations: Mixing a libgraal image built from one GraalVM build with a host JVM of another version; recent method signature changes in the interop API; classpath shadowing so the peer class resolves to a stale copy.
Related errors
- %s has params
- %s is not an enum type
- expected %s, got %s
- %s is not an annotation interface
- Cannot look up %s annotation at Native Image runtime
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/3eef1195fef3f56d.
Report an issue: GitHub.