{"record":{"id":"1cf31976bb75b6a5","repo":"oracle/graal","slug":"getjavavm-passed-jnienv-is-null","errorCode":null,"errorMessage":"GetJavaVM: Passed JNIEnv* is NULL","messagePattern":"GetJavaVM: Passed JNIEnv\\* is NULL","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"espresso/src/com.oracle.truffle.espresso.native/src/nespresso.c","lineNumber":462,"sourceCode":"  jint ret = JNI_OK;\n  jint i;\n  for (i = 0; i < nMethods; ++i) {\n    ret = nespresso_env->RegisterNative(env, clazz, methods[i].name, methods[i].signature, methods[i].fnPtr);\n    if (ret != JNI_OK) {\n        break;\n    }\n  }\n  return ret;\n}\n\njint GetJavaVM(JNIEnv *env, JavaVM **vmPtr) {\n  MokapotEnv* moka_env = NULL;\n  JavaVM* vm = NULL;\n  if (vmPtr == NULL) {\n    return JNI_ERR;\n  }\n  if (env == NULL) {\n    fprintf(stderr, \"GetJavaVM: Passed JNIEnv* is NULL\" OS_NEWLINE_STR);\n    return JNI_ERR;\n  }\n\n  moka_env = (MokapotEnv*) (*env)->reserved1;\n  if (moka_env == NULL) {\n    fprintf(stderr, \"GetJavaVM: Passed JNIEnv* has no MokapotEnv* associated\" OS_NEWLINE_STR);\n    return JNI_ERR;\n  }\n\n  vm = (*moka_env)->vm;\n\n  // If there's an isolate-aware JavaVM, find it.\n  if ((*vm)->reserved1 == MOKA_AMERICANO) {\n    vm = (JavaVM*) (*vm)->reserved2;\n    // MOKA_AMERICANO JavaVM can only point to a MOKA_LATTE.\n    if ((*vm)->reserved1 != MOKA_LATTE) {\n      fprintf(stderr, \"GetJavaVM: not a MOKA_LATTE\" OS_NEWLINE_STR);\n      return JNI_ERR;","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso/src/com.oracle.truffle.espresso.native/src/nespresso.c#L444-L480","documentation":"Error \"GetJavaVM: Passed JNIEnv* is NULL\" thrown in oracle/graal.","triggerScenarios":"Thrown at espresso/src/com.oracle.truffle.espresso.native/src/nespresso.c:462 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: GetJavaVM: Passed JNIEnv* is NULL","solutions":["Fix the condition reported by the error: GetJavaVM: Passed JNIEnv* is NULL","Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call."],"exampleFix":"Validate inputs and environment so that the failing condition does not occur: GetJavaVM: Passed JNIEnv* is NULL","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}