{"record":{"id":"20e8714ee4030408","repo":"oracle/graal","slug":"the-provided-optimization-log-path-does-not-denote","errorCode":null,"errorMessage":"The provided optimization log path does not denote a directory","messagePattern":"The provided optimization log path does not denote a directory","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/ExperimentFilesImpl.java","lineNumber":97,"sourceCode":"        if (proftoolOutputPath == null) {\n            return Optional.empty();\n        }\n        return Optional.of(FileView.fromFile(new File(proftoolOutputPath)));\n    }\n\n    /**\n     * Gets an iterable of file views representing the optimization log. Each file view may contain\n     * several JSON-encoded compilation units separated by a {@code '\\n'}. Individual files are\n     * discovered by listing the files in the provided {@link #optimizationLogPath}.\n     *\n     * @return an iterable of file views representing an optimization log\n     * @throws IOException the optimization log is not a directory\n     */\n    @Override\n    public Iterable<FileView> getOptimizationLogs() throws IOException {\n        File[] files = new File(optimizationLogPath).listFiles();\n        if (files == null) {\n            throw new IOException(\"The provided optimization log path does not denote a directory\");\n        }\n        return () -> Arrays.stream(files).map(FileView::fromFile).iterator();\n    }\n\n    @Override\n    public Experiment.CompilationKind getCompilationKind() {\n        return compilationKind;\n    }\n\n    @Override\n    public ExperimentId getExperimentId() {\n        return experimentId;\n    }\n}\n","sourceCodeStart":79,"sourceCodeEnd":112,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/ExperimentFilesImpl.java#L79-L112","documentation":"ExperimentFilesImpl.getOptimizationLogs throws IOException when File.listFiles() on the configured --optimization-log path returns null, which the JDK does when the path is not a directory (or is unreadable). profdiff requires the optimization log to be a directory of JSON files, one compilation unit sequence per line.","triggerScenarios":"Passing a file path instead of a directory to --optimization-log, a path that does not exist, or a directory the process cannot read/list.","commonSituations":"Users zipping up a single optimization log file and passing that; wrong relative path from a different working directory; typos in the path; the directory removed by cleanup scripts between runs.","solutions":["Pass the directory that directly contains the optimization-log JSON files.","Confirm the path exists and is readable: 'ls <path>' must list the files.","If you only have a single file, put it in an empty directory and pass that directory."],"exampleFix":"# before\nmx profdiff normal-tier --experiment1 exp1 --proftool1 p1.json --optimization-log1 optlog1.json\n# after\nmx profdiff normal-tier --experiment1 exp1 --proftool1 p1.json --optimization-log1 dir-with-optlogs/","handlingStrategy":"validation","validationCode":"File dir = new File(optimizationLogPath);\nif (!dir.isDirectory() || !dir.canRead()) {\n    throw new IllegalArgumentException(\"--optimization-log must be a readable directory: \" + optimizationLogPath);\n}","typeGuard":"static boolean isReadableLogDirectory(String path) {\n    File f = new File(path);\n    return f.isDirectory() && f.canRead() && f.list() != null;\n}","tryCatchPattern":"try {\n    for (FileView fv : experimentFiles.getOptimizationLogs()) { /* ... */ }\n} catch (IOException e) {\n    if (e.getMessage().contains(\"does not denote a directory\")) { /* fix the path */ }\n}","preventionTips":["Always pass a directory, never a single log file.","Use absolute paths and pre-check with 'ls -ld <path>'."],"tags":["profdiff","filesystem","configuration","optimization-log"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}