oracle/graal · error · ExperimentParserError
Failed to parse experiment {experimentId} in compilation uni
Error message
Failed to parse experiment {experimentId} in compilation unit: {message} What it means
CompilationUnitTreeParser.load wraps any IOException raised while reading or structurally parsing one compilation unit of the optimization log into ExperimentParserError, naming the experiment id and the unit ('compilation unit'). The chained message identifies the underlying I/O or decode failure; parsing then aborts for the whole experiment.
Source
Thrown at compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/CompilationUnitTreeParser.java:74
* The file view containing the serialized compilation unit.
*/
private final FileView fileView;
public CompilationUnitTreeParser(ExperimentId experimentId, FileView fileView) {
this.experimentId = experimentId;
this.fileView = fileView;
}
@Override
public CompilationUnit.TreePair load() throws ExperimentParserError {
try {
ExperimentJSONParser parser = new ExperimentJSONParser(experimentId, fileView);
ExperimentJSONParser.JSONMap map = parser.parse().asMap();
InliningTree inliningTree = new InliningTree(parseInliningTreeNode(map.property(OptimizationLogImpl.INLINING_TREE_PROPERTY).asMap()));
OptimizationTree optimizationTree = new OptimizationTree(parseOptimizationPhase(map.property(OptimizationLogImpl.OPTIMIZATION_TREE_PROPERTY).asMap()));
return new CompilationUnit.TreePair(optimizationTree, inliningTree);
} catch (IOException e) {
throw new ExperimentParserError(experimentId, "compilation unit", e.getMessage());
}
}
private static InliningTreeNode parseInliningTreeNode(ExperimentJSONParser.JSONMap map) throws ExperimentParserTypeError {
String methodName = map.property(OptimizationLogImpl.METHOD_NAME_PROPERTY).asNullableString();
if (methodName != null) {
methodName = Method.removeMethodVariantKey(methodName);
}
int bci = map.property(OptimizationLogImpl.CALLSITE_BCI_PROPERTY).asInt();
boolean positive = map.property(OptimizationLogImpl.INLINED_PROPERTY).asBoolean();
List<String> reason = new ArrayList<>();
ExperimentJSONParser.JSONLiteral reasonObject = map.property(OptimizationLogImpl.REASON_PROPERTY);
if (!reasonObject.isNull()) {
for (ExperimentJSONParser.JSONLiteral reasonItem : reasonObject.asList()) {
reason.add(reasonItem.asString());
}
}
boolean indirect = map.property(OptimizationLogImpl.INDIRECT_PROPERTY).asBoolean();View on GitHub (pinned to a66e9ccd1d)
Solutions
- Verify the optimization-log directory is fully written and the JVM run finished before parsing.
- Check file permissions and completeness (file size > 0, valid JSON per line).
- Re-run the experiment if the log is truncated or partially missing.
- Ensure the same experiment's proftool output and optimization logs come from one run.
Defensive patterns
Strategy: try-catch
Validate before calling
// Before parsing, verify each log file is readable and non-empty
for (FileView fv : experimentFiles.getOptimizationLogs()) {
if (fv.readFully().isEmpty()) throw new IllegalStateException("Empty log: " + fv.getSymbolicPath());
} Try / catch
try {
TreePair pair = treeParser.load();
} catch (ExperimentParserError e) {
// e names experimentId and 'compilation unit'; check file integrity, then re-record the log
} Prevention
- Only parse optimization logs from completed JVM runs.
- Copy logs atomically (to a temp name, then rename) while the writer may still be active.
When it happens
Trigger: An optimization-log file becoming unreadable mid-run (deleted, truncated by a crashed JVM, permissions changed), or fileView.readFully() failing while ExperimentJSONParser reads one JSON compilation unit of experiment 'experimentId'.
Common situations: Pointing --optimization-log at a directory still being written by a running benchmark; copying logs while the writer is active; NFS/permission hiccups; truncated files from an OOM-killed JVM.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to print the optimization log to a file: %s
- Failed to parse experiment {experimentId} in {resource}: exp
- The provided optimization log path does not denote a directo
- Failed to parse experiment {experimentId} in {resource}: exp
- Failed to parse experiment {experimentId} in {resource}: {me
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/9d91b4e8cd438e1c.
Report an issue: GitHub.