{"record":{"id":"865c02a559b3582a","repo":"pinpoint-apm/pinpoint","slug":"not-file","errorCode":null,"errorMessage":" not file","messagePattern":" not file","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JarFileUtils.java","lineNumber":40,"sourceCode":"import java.util.Objects;\nimport java.util.jar.JarFile;\n\n/**\n * @author Woonduk Kang(emeroad)\n */\nfinal class JarFileUtils {\n\n    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":22,"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#L22-L52","documentation":"JarFileUtils.openJarFile(Path) requires a regular file: if Files.isRegularFile(path) is false (and it is not a directory — that case is caught earlier) it throws IllegalArgumentException with \"<path> not file\". This catches special files (symlink loops, devices, sockets, FIFOs, broken symlinks that pass exists-checks inconsistently) that cannot be opened as a JarFile.","triggerScenarios":"Calling JarFileUtils.openJarFile(path) with a path that exists but is not a regular file — e.g. a device node, named pipe, unix socket, dangling symlink, or other special filesystem entry.","commonSituations":"Mount points or containers exposing device/socket files inside the scanned lib directory; broken symbolic links left by interrupted deployments or package managers; CI environments where build outputs were replaced by pipes (e.g. `unzip - | ...` mishaps).","solutions":["Verify the entry is a real file: `stat <path>` / Files.isRegularFile(path); remove or replace broken symlinks and special files.","Re-deploy the JAR (copy the real file) if a symlink is dangling or was replaced by a pipe/socket.","Filter scan results with Files.isRegularFile before calling openJarFile.","Check for symlink loops (Files.isSymbolicLink + toRealPath) and use the resolved real path."],"exampleFix":"// before\nJarFile jar = JarFileUtils.openJarFile(path); // path is a dangling symlink\n// after\nPath real = path.toAbsolutePath();\nif (Files.isSymbolicLink(path)) {\n    real = Files.readSymbolicLink(path).toAbsolutePath();\n}\nif (Files.isRegularFile(real)) {\n    JarFile jar = JarFileUtils.openJarFile(real);\n}","handlingStrategy":"type-guard","validationCode":"Path real = candidate;\nif (Files.isSymbolicLink(candidate)) {\n    real = candidate.toRealPath();\n}\nif (!Files.isRegularFile(real)) {\n    throw new IllegalArgumentException(\"Not a regular file: \" + real);\n}","typeGuard":"static boolean isRegularJarFile(Path p) {\n    try {\n        Path real = p.toRealPath();\n        return Files.isRegularFile(real) && real.toString().endsWith(\".jar\");\n    } catch (IOException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    JarFile jar = JarFileUtils.openJarFile(path);\n} catch (IllegalArgumentException e) {\n    if (String.valueOf(e.getMessage()).endsWith(\"not file\")) {\n        logger.warn(\"Skipping non-regular file: {}\", path);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Resolve symlinks with toRealPath() before opening JARs.","Detect and remove dangling symlinks after deployments (find -L <dir> -type l).","Exclude device/socket/FIFO entries when scanning directories.","Copy real files into the agent dir rather than symlinking across mounts or containers."],"tags":["jar","symlink","illegal-argument","filesystem"],"backgroundTag":"file-not-found","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"}