oracle/graal · error · IOException
The provided optimization log path does not denote a directo
Error message
The provided optimization log path does not denote a directory
What it means
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.
Source
Thrown at compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/ExperimentFilesImpl.java:97
if (proftoolOutputPath == null) {
return Optional.empty();
}
return Optional.of(FileView.fromFile(new File(proftoolOutputPath)));
}
/**
* Gets an iterable of file views representing the optimization log. Each file view may contain
* several JSON-encoded compilation units separated by a {@code '\n'}. Individual files are
* discovered by listing the files in the provided {@link #optimizationLogPath}.
*
* @return an iterable of file views representing an optimization log
* @throws IOException the optimization log is not a directory
*/
@Override
public Iterable<FileView> getOptimizationLogs() throws IOException {
File[] files = new File(optimizationLogPath).listFiles();
if (files == null) {
throw new IOException("The provided optimization log path does not denote a directory");
}
return () -> Arrays.stream(files).map(FileView::fromFile).iterator();
}
@Override
public Experiment.CompilationKind getCompilationKind() {
return compilationKind;
}
@Override
public ExperimentId getExperimentId() {
return experimentId;
}
}
View on GitHub (pinned to a66e9ccd1d)
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.
Example fix
# before mx profdiff normal-tier --experiment1 exp1 --proftool1 p1.json --optimization-log1 optlog1.json # after mx profdiff normal-tier --experiment1 exp1 --proftool1 p1.json --optimization-log1 dir-with-optlogs/
Defensive patterns
Strategy: validation
Validate before calling
File dir = new File(optimizationLogPath);
if (!dir.isDirectory() || !dir.canRead()) {
throw new IllegalArgumentException("--optimization-log must be a readable directory: " + optimizationLogPath);
} Type guard
static boolean isReadableLogDirectory(String path) {
File f = new File(path);
return f.isDirectory() && f.canRead() && f.list() != null;
} Try / catch
try {
for (FileView fv : experimentFiles.getOptimizationLogs()) { /* ... */ }
} catch (IOException e) {
if (e.getMessage().contains("does not denote a directory")) { /* fix the path */ }
} Prevention
- Always pass a directory, never a single log file.
- Use absolute paths and pre-check with 'ls -ld <path>'.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to print the optimization log to a file: %s
- Could not read the files of the experiment {experimentId}: {
- Invalid directed inlining rules file path: {path}
- Failed to parse experiment {experimentId} in compilation uni
- Failed to parse experiment {experimentId} in {resource}: exp
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/20e8714ee4030408.
Report an issue: GitHub.