{"record":{"id":"2f2f87a4cfeb6372","repo":"oracle/graal","slug":"failed-to-open-s-s","errorCode":null,"errorMessage":"Failed to open %s: %s","messagePattern":"Failed to open (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"espresso/src/com.oracle.truffle.espresso.mokapot/src/mokapot.c","lineNumber":1876,"sourceCode":"        // .../lib/<arch>/truffle/libjvm.so\n        //        ^\n        if (pos - mokapot_path < 3 || strncmp(pos - 3, EXPECT_LIB, 3) != 0) {\n            return NULL;\n        }\n    }\n    unsigned long prefix_len = pos - 3 - mokapot_path;\n    size_t lib_name_len = strlen(lib_path);\n    if (prefix_len + lib_name_len + 1 > MAX_PATH) {\n        return NULL;\n    }\n    char espresso_path[MAX_PATH];\n    strncpy(espresso_path, mokapot_path, prefix_len);\n    strncpy(espresso_path + prefix_len, lib_path, MAX_PATH - prefix_len);\n    espresso_path[prefix_len + lib_name_len] = '\\0';\n\n    OS_DL_HANDLE libjavavm = os_dl_open(espresso_path);\n    if (libjavavm == NULL) {\n        fprintf(stderr, \"Failed to open %s: %s\" OS_NEWLINE_STR, espresso_path, os_dl_error());\n        return NULL;\n    }\n\n#define BIND_LIBJAVAVM_SVM_API(X) \\\n    graal_ ## X ## _fn_t graal_ ## X = os_dl_sym(libjavavm, \"graal_\" #X); \\\n    if (graal_ ## X == NULL) { \\\n        graal_ ## X = os_dl_sym(libjavavm, \"truffle_isolate_\" #X); \\\n        if (graal_ ## X == NULL) { \\\n            fprintf(stderr, \"%s does not contain the expected libjavavm interface: missing \" #X OS_NEWLINE_STR, espresso_path); \\\n            return NULL; \\\n        } \\\n    }\n\n#define BIND_LIBJAVAVM(X) \\\n    X ## _fn_t X = os_dl_sym(libjavavm, #X); \\\n    if (X == NULL) { \\\n        fprintf(stderr, \"%s does not contain the expected libjavavm interface: missing \" #X OS_NEWLINE_STR, espresso_path); \\\n        return NULL; \\","sourceCodeStart":1858,"sourceCodeEnd":1894,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso/src/com.oracle.truffle.espresso.mokapot/src/mokapot.c#L1858-L1894","documentation":"Printed by mokapot.c when os_dl_open (dlopen/LoadLibrary) fails to load libjavavm from a derived path, and NULL is returned, aborting JVM creation. mokapot computes the libjavavm location by replacing its own library name inside its loaded path with 'libjavavm.so'; if that file is missing, unreadable, or has unresolved dependencies, the dynamic loader error is printed alongside the path.","triggerScenarios":"Deploying libmokapot.so without libjavavm.so next to (or in the relative position matching) it; partial native-image extractions; ABI/library-version mismatch (libjavavm built against a different libgraal); missing transitive shared libraries reported by os_dl_error().","commonSituations":"Bundling only some .so files into a Docker image; LD_LIBRARY_PATH/finalName tricks that relocate libjavavm; upgrading GraalVM while shipping stale native libraries from the previous version.","solutions":["Verify the printed espresso_path exists and is readable: ls -l <espresso_path>","Check unresolved dependencies: ldd <espresso_path> (or dumpbin on Windows) and install/ship the missing libs","Keep libjavavm.so in the same directory layout relative to libmokapot.so as in the original GraalVM distribution","Rebuild/redeploy with matching GraalVM/Espresso component versions"],"exampleFix":"# diagnose\nldd /path/to/libjavavm.so   # look for 'not found' entries\n# fix by shipping the missing dependency next to it\nexport LD_LIBRARY_PATH=/app/libs:$LD_LIBRARY_PATH","handlingStrategy":"fallback","validationCode":"# before embedding mokapot, verify libjavavm is resolvable\nls -l \"$(dirname libmokapot.so)/libjavavm.so\" || echo \"missing libjavavm next to mokapot\"\nldd \"$(dirname libmokapot.so)/libjavavm.so\" | grep 'not found' && echo \"unresolved deps\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ship libjavavm.so with the same relative layout as the GraalVM distribution","Run ldd on libjavavm.so as part of deployment checks","Keep libmokapot, libjavavm, and the GraalVM build on matched versions"],"tags":["espresso","mokapot","native","dlopen","deployment","c"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}