{"record":{"id":"34c7d1f012f96897","repo":"pinpoint-apm/pinpoint","slug":"lib-dir-is-empty","errorCode":null,"errorMessage":" lib dir is empty","messagePattern":" lib dir is empty","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/AgentDirBaseClassPathResolver.java","lineNumber":143,"sourceCode":"    }\n\n    private Path getAgentLibPath(Path agentDirPath) {\n        return agentDirPath.resolve(\"lib\");\n    }\n\n    private Path getAgentPluginPath(Path agentDirPath) {\n        return agentDirPath.resolve(\"plugin\");\n    }\n\n    private List<Path> resolveLib(Path agentLibPath) {\n\n        if (checkDirectory(agentLibPath)) {\n            return Collections.emptyList();\n        }\n\n        final List<Path> libFileList = FileUtils.listFiles(agentLibPath, EXTENSIONS);\n        if (libFileList.isEmpty()) {\n            throw new RuntimeException(agentLibPath + \" lib dir is empty\");\n        }\n        // add directory\n        libFileList.add(agentLibPath);\n\n        return libFileList;\n    }\n\n    private List<Path> resolvePlugins(Path agentPluginPath) {\n\n        if (checkDirectory(agentPluginPath)) {\n            logger.warn(agentPluginPath + \" is not a directory\");\n            return Collections.emptyList();\n        }\n\n        final List<Path> jars = FileUtils.listFiles(agentPluginPath, \"*.jar\");\n        if (jars.isEmpty()) {\n            return Collections.emptyList();\n        }","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/AgentDirBaseClassPathResolver.java#L125-L161","documentation":"resolveLib() lists jars in the agent's lib directory (filtered by known extensions) and throws RuntimeException '<libPath> lib dir is empty' when the listing is empty. Pinpoint requires plugin/core jars in the lib directory to build the agent class path; an empty lib dir means the installation is incomplete.","triggerScenarios":"agentLibPath exists (passes checkDirectory) but contains no files with the configured extensions (e.g. .jar); FileUtils.listFiles returns an empty list.","commonSituations":"Partial agent extraction (only config files copied); an antivirus or cleanup job purged the lib folder; pointing the agent at a wrong subdirectory that has an empty lib; failed upgrade leaving lib empty.","solutions":["Re-extract the full Pinpoint agent distribution so the lib directory contains its jars","Point the agent at the correct agent directory (one that actually has a populated lib folder)","Check extension filters: ensure jars are named *.jar and not stripped of extensions","Verify no cleanup/AV process deleted the lib contents; restore from the release archive"],"exampleFix":"// before\nls /opt/pinpoint-agent/lib  ->  (empty)\n// after\ntar xzf pinpoint-agent-2.5.0.tar.gz -C /opt/  && ls /opt/pinpoint-agent/lib | head  # jars present","handlingStrategy":"validation","validationCode":"Path lib = Paths.get(\"/opt/pinpoint-agent/lib\");\nif (!Files.isDirectory(lib) || listNonEmpty(lib) == false) {\n    throw new IllegalStateException(\"agent lib dir missing or empty: \" + lib);\n}\n\nboolean listNonEmpty(Path dir) {\n    try (var s = Files.list(dir)) { return s.findFirst().isPresent(); }\n    catch (IOException e) { return false; }\n}","typeGuard":"boolean hasLibJars(Path libDir) throws IOException {\n    if (libDir == null || !Files.isDirectory(libDir)) return false;\n    try (var s = Files.list(libDir)) {\n        return s.anyMatch(p -> p.toString().endsWith(\".jar\"));\n    }\n}","tryCatchPattern":"try {\n    AgentDirectory dir = resolver.resolve();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().endsWith(\" lib dir is empty\")) {\n        // re-extract agent distribution before continuing\n    }\n    throw e;\n}","preventionTips":["Verify archive checksums after download to catch truncated extractions","Check agent dir contents (lib populated) as a post-install step","Exclude the agent dir from antivirus scans and cleanup jobs","Use a versioned agent directory and update symlinks atomically"],"tags":["java","empty-directory","agent-bootstrap","installation"],"backgroundTag":"directory-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"}