{"record":{"id":"1cdbd037e56e6119","repo":"openjdk/jdk","slug":"warning-unable-to-canonicalize-s-n","errorCode":null,"errorMessage":"WARNING: unable to canonicalize %s\\n","messagePattern":"WARNING: unable to canonicalize (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java.instrument/share/native/libinstrument/InvocationAdapter.c","lineNumber":946,"sourceCode":"\n        /*\n         * If the path is an absolute path then add to the bootclassloader\n         * search path. Otherwise we get the canonical path of the agent jar\n         * and then use its base path (directory) to resolve the given path\n         * segment.\n         *\n         * NOTE: JVMTI is specified to use modified UTF8 strings (like JNI).\n         * In 1.5.0 the AddToBootstrapClassLoaderSearch takes a platform string\n         * - see 5049313.\n         */\n        if (isAbsolute(path)) {\n            jvmtierr = (*jvmtienv)->AddToBootstrapClassLoaderSearch(jvmtienv, path);\n        } else {\n            char* resolved;\n\n            if (!haveBasePath) {\n                if (JDK_Canonicalize((char*)jarfile, canonicalPath, sizeof(canonicalPath)) != 0) {\n                    fprintf(stderr, \"WARNING: unable to canonicalize %s\\n\", jarfile);\n                    free(path);\n                    continue;\n                }\n                parent = basePath(canonicalPath);\n                jplis_assert(parent != (char*)NULL);\n                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);","sourceCodeStart":928,"sourceCodeEnd":964,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/java.instrument/share/native/libinstrument/InvocationAdapter.c#L928-L964","documentation":"Warning from Boot-Class-Path processing for a relative entry: JDK_Canonicalize failed on the agent jar's own path, so the relative boot path cannot be resolved against the jar's parent directory and the entry is skipped. Startup continues without this bootstrap search entry.","triggerScenarios":"The agent jar path itself cannot be canonicalized — deleted or renamed jar between load and canonicalization, permission problems reading the directory, or a path exceeding platform limits.","commonSituations":"Attaching to a jar that a cleanup process deletes mid-attach; agents loaded from ephemeral temp directories; network-mounted filesystems with canonicalization failures.","solutions":["Copy the agent jar to a stable, readable local directory before loading it","Use absolute paths in Boot-Class-Path so no canonicalization of the jar location is needed","Ensure the JVM user has read/traverse permissions on every component of the jar path"],"exampleFix":"# before\nBoot-Class-Path: lib/extra-boot.jar  # relative, needs canonicalize\n# after\nBoot-Class-Path: /opt/agent/lib/extra-boot.jar  # absolute","handlingStrategy":"validation","validationCode":"// pre-canonicalize at deploy time and verify readability\nPath p = Path.of(agentPath).toRealPath(); // throws if unresolvable\nif (!Files.isReadable(p)) throw new IllegalStateException(\"agent jar unreadable: \" + p);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep agent jars on stable local filesystems, not tmp cleaners or flaky mounts","Use absolute Boot-Class-Path entries to avoid jar-location canonicalization entirely"],"tags":["java-instrument","boot-class-path","filesystem","path-resolution","classpath"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}