{"record":{"id":"5b60a1e49741764a","repo":"pinpoint-apm/pinpoint","slug":"create-fail-caused-by-5b60a1","errorCode":null,"errorMessage":" create fail Caused by:","messagePattern":" create fail Caused by:","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JarFileUtils.java","lineNumber":48,"sourceCode":"    public static JarFile openJarFile(Path path) {\n        Objects.requireNonNull(path, \"path\");\n\n        if (!Files.exists(path)) {\n            throw new IllegalArgumentException(path + \" not found\");\n        }\n        if (Files.isDirectory(path)) {\n            throw new IllegalArgumentException(path + \" is directory\");\n        }\n        if (!Files.isRegularFile(path)) {\n            throw new IllegalArgumentException(path + \" not file\");\n        }\n        if (!Files.isReadable(path)) {\n            throw new IllegalArgumentException(path + \" can read\");\n        }\n        try {\n            return new JarFile(path.toFile());\n        } catch (IOException e) {\n            throw new IllegalStateException(path + \" create fail Caused by:\" + e.getMessage(), e);\n        }\n    }\n}\n","sourceCodeStart":30,"sourceCodeEnd":52,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JarFileUtils.java#L30-L52","documentation":"Thrown by JarFileUtils.openJarFile when new JarFile(file) throws IOException even though the path passed the is-directory/is-file/is-readable checks. It wraps the underlying IOException (corrupt jar, wrong format, I/O failure) into an IllegalStateException with the path and cause message attached.","triggerScenarios":"Calling openJarFile(Path) on a file that exists and is readable but is not a valid zip/jar (truncated download, text file renamed to .jar), or an actual transient I/O error while opening.","commonSituations":"Corrupted or partially-uploaded plugin jar in the agent dir; a non-jar file placed in the plugin directory; disk/IO errors; jars built with unsupported zip features.","solutions":["Read the wrapped cause in the exception message/stack trace to see the real IOException","Validate the jar: run 'jar tf <file>' or 'unzip -t <file>' to test integrity","Re-download/rebuild the corrupted jar and redeploy the agent","Confirm the file is actually a jar (file <path> shows 'Zip archive'), not a misnamed text file"],"exampleFix":"// before\nPath p = Paths.get(\"/agent/plugin/truncated.jar\"); // corrupted download\nJarFile jf = JarFileUtils.openJarFile(p); // IllegalStateException create fail\n// after\n// re-download/rebuild the jar, verify with: unzip -t /agent/plugin/truncated.jar\nJarFile jf = JarFileUtils.openJarFile(p); // OK","handlingStrategy":"try-catch","validationCode":"try (JarFile probe = new JarFile(path.toFile())) { /* valid zip */ } catch (IOException e) { throw new IllegalStateException(\"invalid jar: \" + path, e); }","typeGuard":"boolean isValidZip(Path p) { try { new java.util.zip.ZipFile(p.toFile()).close(); return true; } catch (IOException e) { return false; } }","tryCatchPattern":"try { return JarFileUtils.openJarFile(path); } catch (IllegalStateException e) { log.error(\"jar open failed: {}\", e.getMessage(), e.getCause()); throw e; }","preventionTips":["Verify jar integrity (unzip -t) after download/deploy","Never rename non-jar files to .jar in plugin dirs","Use atomic move (Files.move ATOMIC_MOVE) when updating jars"],"tags":["java","jar","corrupt-file","io"],"backgroundTag":"file-open-failed","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}