{"record":{"id":"6428eda8151196e6","repo":"elastic/elasticsearch","slug":"path-does-not-exist-path","errorCode":null,"errorMessage":"Path does not exist: {path}","messagePattern":"Path does not exist: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"libs/core/src/main/java/org/elasticsearch/jdk/JdkJarHellCheck.java","lineNumber":60,"sourceCode":"                        detected.add(entry.replace(\"/\", \".\").replace(\".class\", \"\"));\n                    }\n                }\n                return FileVisitResult.CONTINUE;\n            }\n        });\n    }\n\n    public Set<String> getDetected() {\n        return Collections.unmodifiableSet(detected);\n    }\n\n    @SuppressForbidden(reason = \"command line tool\")\n    public static void main(String[] argv) throws IOException {\n        JdkJarHellCheck checker = new JdkJarHellCheck();\n        for (String location : argv) {\n            Path path = Paths.get(location);\n            if (Files.exists(path) == false) {\n                throw new IllegalArgumentException(\"Path does not exist: \" + path);\n            }\n            checker.scanForJDKJarHell(path);\n        }\n        if (checker.getDetected().isEmpty()) {\n            System.exit(0);\n        } else {\n            checker.getDetected().forEach(System.out::println);\n            System.exit(1);\n        }\n    }\n\n}\n","sourceCodeStart":42,"sourceCodeEnd":73,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/libs/core/src/main/java/org/elasticsearch/jdk/JdkJarHellCheck.java#L42-L73","documentation":"Thrown by JdkJarHellCheck.main (a command-line tool) when one of the path arguments passed on the command line does not exist on the filesystem. The tool scans each argument for JDK jar-hell conditions; a non-existent path is rejected immediately rather than scanned. This is distinct from the runtime JarHell scan and is used to pre-check a distribution.","triggerScenarios":"Invoking the JdkJarHellCheck CLI with a path argument that Files.exists() reports as false. The loop iterates argv, constructs Paths.get(location), and throws IllegalArgumentException before scanForJDKJarHell.","commonSituations":"Typo in the path argument; relative path resolved against an unexpected working directory; the target directory was not yet built; CI invoked the tool before artifacts were assembled.","solutions":["Verify the path exists: 'ls -la <path>' using the same working directory the tool runs from.","Use absolute paths when invoking JdkJarHellCheck to avoid cwd-relative resolution issues.","Ensure the build step that produces the target directory/jar runs before this check."],"exampleFix":"// before\njava ... JdkJarHellCheck build/distributions/es lib/modules\n// 'Path does not exist: build/distributions/es'\n\n// after: run after the build, with an absolute path\n./gradlew assemble\njava ... JdkJarHellCheck /abs/path/to/build/distributions/es /abs/path/to/lib/modules","handlingStrategy":"validation","validationCode":"// Before invoking the CLI, check each arg exists\nimport java.nio.file.*;\n\nfor (String a : argv) {\n  if (!Files.exists(Paths.get(a))) throw new IllegalArgumentException(a + \" missing\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  JdkJarHellCheck.main(args);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Path does not exist\")) {\n    System.err.println(\"Fix the path argument: \" + e.getMessage());\n  } else throw e;\n}","preventionTips":["Pass absolute paths to the JdkJarHellCheck CLI.","Run the check only after the assemble/build task completes."],"tags":["jar-hell","cli","path-validation","filesystem"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}