{"record":{"id":"6753d0211739f5b6","repo":"pinpoint-apm/pinpoint","slug":"file-create-fail","errorCode":null,"errorMessage":"${file} create fail","messagePattern":"(.+?) create fail","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/scanner/JarFileScanner.java","lineNumber":50,"sourceCode":"    private final JarFile jarFile;\n\n\n    public static JarFileScanner of(String path) {\n        Objects.requireNonNull(path, \"path\");\n        return new JarFileScanner(new File(path));\n    }\n\n    public static JarFileScanner of(Path path) {\n        Objects.requireNonNull(path, \"path\");\n        return new JarFileScanner(path.toFile());\n    }\n\n    private JarFileScanner(File file) {\n        Objects.requireNonNull(file, \"file\");\n        try {\n            this.jarFile = new JarFile(file);\n        } catch (IOException e) {\n            throw new IllegalStateException(file + \" create fail\");\n        }\n    }\n\n    @Override\n    public boolean exist(String fileName) {\n        final JarEntry jarEntry = jarFile.getJarEntry(fileName);\n        return jarEntry != null;\n    }\n\n\n    @Override\n    public InputStream openStream(String fileName) {\n        final JarEntry jarEntry = jarFile.getJarEntry(fileName);\n        if (jarEntry == null) {\n            return null;\n        }\n        try {\n            return jarFile.getInputStream(jarEntry);","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/scanner/JarFileScanner.java#L32-L68","documentation":"JarFileScanner's private constructor opens the target file as a JarFile; if the file cannot be opened as a jar (IOException), it wraps the failure in IllegalStateException with '<file> create fail'. The original IOException cause is swallowed.","triggerScenarios":"Constructing a JarFileScanner over a file that is missing, unreadable, corrupt, not a zip/jar, or locked by another process.","commonSituations":"Agent pointing at a stale or partially-downloaded jar; plugin directories containing empty/corrupt files; permission problems on the jar path; scanning a directory-classpath entry that is not a jar.","solutions":["Verify the file exists and is readable, and is a valid zip/jar (unzip -t)","Restore or re-download the corrupted/missing jar","Check file permissions and that no other process holds an incompatible lock on the file","Wrap construction in try-catch for IllegalStateException since the underlying IOException is not propagated"],"exampleFix":"// before\nFile f = new File(\"/plugins/app.jar\"); // truncated download\nScanner s = JarFileScanner.create(f);\n// after\nFile f = new File(\"/plugins/app.jar\");\nif (f.isFile() && f.length() > 0 && f.canRead()) {\n    Scanner s = JarFileScanner.create(f);\n}","handlingStrategy":"try-catch","validationCode":"if (!file.isFile() || !file.canRead() || file.length() == 0) throw new IllegalStateException(\"invalid jar file: \" + file);","typeGuard":null,"tryCatchPattern":"try { scanner = JarFileScanner.create(jar); } catch (IllegalStateException e) { log.error(\"cannot open jar {}: {}\", jar, e.getMessage()); }","preventionTips":["Verify jar integrity after download/copy","Check file permissions on plugin directories","Catch IllegalStateException since the IOException cause is not propagated"],"tags":["java","jarfile","io","file-open-failed","scanner"],"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-17T15:17:12.973Z"}