{"record":{"id":"fecfe643fe1efebe","repo":"openjdk/jdk","slug":"unexpected-error-d-n","errorCode":null,"errorMessage":"Unexpected error: %d\\n","messagePattern":"Unexpected error: (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java.instrument/share/native/libinstrument/InvocationAdapter.c","lineNumber":970,"sourceCode":"                haveBasePath = 1;\n            }\n\n            resolved = resolve(parent, path);\n            jvmtierr = (*jvmtienv)->AddToBootstrapClassLoaderSearch(jvmtienv, resolved);\n            free(resolved);\n        }\n\n        /* print warning if boot class path not updated */\n        if (jvmtierr != JVMTI_ERROR_NONE) {\n            check_phase_blob_ret(jvmtierr, free(path));\n\n            fprintf(stderr, \"WARNING: %s not added to bootstrap class loader search: \", path);\n            switch (jvmtierr) {\n                case JVMTI_ERROR_ILLEGAL_ARGUMENT :\n                    fprintf(stderr, \"Illegal argument or not JAR file\\n\");\n                    break;\n                default:\n                    fprintf(stderr, \"Unexpected error: %d\\n\", jvmtierr);\n            }\n        }\n\n        /* finished with the path */\n        free(path);\n    }\n\n\n    /* clean-up */\n    if (haveBasePath && parent != canonicalPath) {\n        free(parent);\n    }\n    free(paths);\n}\n","sourceCodeStart":952,"sourceCodeEnd":985,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/java.instrument/share/native/libinstrument/InvocationAdapter.c#L952-L985","documentation":"Generic reason suffix for the bootstrap-add warning: AddToBootstrapClassLoaderSearch returned an unexpected JVMTI error code (number printed). Typical codes: 30 WRONG_PHASE (JVM past live phase), 109 OUT_OF_MEMORY, or internal errors. The entry is skipped and startup continues.","triggerScenarios":"Boot-Class-Path processing occurring during JVM shutdown/wrong phase; native OOM; JVMTI internal failure.","commonSituations":"Agents attaching late in JVM lifetime; memory-pressured JVMs; rarely, JDK bugs.","solutions":["Decode the number against the jvmtiError enum (e.g. 30=WRONG_PHASE, 109=OUT_OF_MEMORY) and address that condition","Load the agent earlier (launch-time -javaagent) so boot path updates happen in the correct phase","Free native memory / raise limits if OOM is indicated","Retry the load once the JVM is stably in the live phase"],"exampleFix":"# before: attaching during shutdown\nvm.loadAgent(...); // WRONG_PHASE (30)\n# after: attach while app is running\nvm.loadAgent(...);","handlingStrategy":"fallback","validationCode":"// check JVM liveness phase before attaching\nif (vm instanceof VirtualMachine && Boolean.getBoolean(\"shutdown.in.progress\"))\n    throw new IllegalStateException(\"refusing to attach during shutdown\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Attach during stable live phase; avoid shutdown hooks","Decode unexpected JVMTI codes against the jvmtiError enum before retrying blindly"],"tags":["java-instrument","boot-class-path","jvmti","diagnostics","classpath"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}