oracle/graal · error

GetJavaVM: not a MOKA_RISTRETTO

Error message

GetJavaVM: not a MOKA_RISTRETTO

What it means

Error "GetJavaVM: not a MOKA_RISTRETTO" thrown in oracle/graal.

Source

Thrown at espresso/src/com.oracle.truffle.espresso.native/src/nespresso.c:483

  moka_env = (MokapotEnv*) (*env)->reserved1;
  if (moka_env == NULL) {
    fprintf(stderr, "GetJavaVM: Passed JNIEnv* has no MokapotEnv* associated" OS_NEWLINE_STR);
    return JNI_ERR;
  }

  vm = (*moka_env)->vm;

  // If there's an isolate-aware JavaVM, find it.
  if ((*vm)->reserved1 == MOKA_AMERICANO) {
    vm = (JavaVM*) (*vm)->reserved2;
    // MOKA_AMERICANO JavaVM can only point to a MOKA_LATTE.
    if ((*vm)->reserved1 != MOKA_LATTE) {
      fprintf(stderr, "GetJavaVM: not a MOKA_LATTE" OS_NEWLINE_STR);
      return JNI_ERR;
    }
  } else if ((*vm)->reserved1 != MOKA_RISTRETTO) {
    fprintf(stderr, "GetJavaVM: not a MOKA_RISTRETTO" OS_NEWLINE_STR);
    return JNI_ERR;
  }

  *vmPtr = vm;
  return JNI_OK;
}

static void unset_function_error() {
  fprintf(stderr, "Call to uninitialized JNI function slot" OS_NEWLINE_STR);
  exit(-1);
}

JNIEXPORT JNIEnv* JNICALL initializeNativeContext(void* (*fetch_by_name)(const char *)) {
  JNIEnv* env = (JNIEnv*) malloc(sizeof(*env));
  struct JNINativeInterface_* jni_impl = malloc(sizeof(*jni_impl));
  struct NespressoEnv* nespresso_env = (struct NespressoEnv*) malloc(sizeof(*nespresso_env));

  jni_impl->reserved0 = nespresso_env;

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the condition reported by the error: GetJavaVM: not a MOKA_RISTRETTO
  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: GetJavaVM: not a MOKA_RISTRETTO

When it happens

Trigger: Thrown at espresso/src/com.oracle.truffle.espresso.native/src/nespresso.c:483 when the library encounters an invalid state.

Common situations: Occurs when a caller violates the contract guarded by this check: GetJavaVM: not a MOKA_RISTRETTO


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