{"record":{"id":"9d91b4e8cd438e1c","repo":"oracle/graal","slug":"failed-to-parse-experiment-experimentid-in-compi","errorCode":null,"errorMessage":"Failed to parse experiment {experimentId} in compilation unit: {message}","messagePattern":"Failed to parse experiment (.+?) in compilation unit: (.+?)","errorType":"exception","errorClass":"ExperimentParserError","httpStatus":null,"severity":"error","filePath":"compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/CompilationUnitTreeParser.java","lineNumber":74,"sourceCode":"     * The file view containing the serialized compilation unit.\n     */\n    private final FileView fileView;\n\n    public CompilationUnitTreeParser(ExperimentId experimentId, FileView fileView) {\n        this.experimentId = experimentId;\n        this.fileView = fileView;\n    }\n\n    @Override\n    public CompilationUnit.TreePair load() throws ExperimentParserError {\n        try {\n            ExperimentJSONParser parser = new ExperimentJSONParser(experimentId, fileView);\n            ExperimentJSONParser.JSONMap map = parser.parse().asMap();\n            InliningTree inliningTree = new InliningTree(parseInliningTreeNode(map.property(OptimizationLogImpl.INLINING_TREE_PROPERTY).asMap()));\n            OptimizationTree optimizationTree = new OptimizationTree(parseOptimizationPhase(map.property(OptimizationLogImpl.OPTIMIZATION_TREE_PROPERTY).asMap()));\n            return new CompilationUnit.TreePair(optimizationTree, inliningTree);\n        } catch (IOException e) {\n            throw new ExperimentParserError(experimentId, \"compilation unit\", e.getMessage());\n        }\n    }\n\n    private static InliningTreeNode parseInliningTreeNode(ExperimentJSONParser.JSONMap map) throws ExperimentParserTypeError {\n        String methodName = map.property(OptimizationLogImpl.METHOD_NAME_PROPERTY).asNullableString();\n        if (methodName != null) {\n            methodName = Method.removeMethodVariantKey(methodName);\n        }\n        int bci = map.property(OptimizationLogImpl.CALLSITE_BCI_PROPERTY).asInt();\n        boolean positive = map.property(OptimizationLogImpl.INLINED_PROPERTY).asBoolean();\n        List<String> reason = new ArrayList<>();\n        ExperimentJSONParser.JSONLiteral reasonObject = map.property(OptimizationLogImpl.REASON_PROPERTY);\n        if (!reasonObject.isNull()) {\n            for (ExperimentJSONParser.JSONLiteral reasonItem : reasonObject.asList()) {\n                reason.add(reasonItem.asString());\n            }\n        }\n        boolean indirect = map.property(OptimizationLogImpl.INDIRECT_PROPERTY).asBoolean();","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/CompilationUnitTreeParser.java#L56-L92","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before parsing, verify each log file is readable and non-empty\nfor (FileView fv : experimentFiles.getOptimizationLogs()) {\n    if (fv.readFully().isEmpty()) throw new IllegalStateException(\"Empty log: \" + fv.getSymbolicPath());\n}","typeGuard":null,"tryCatchPattern":"try {\n    TreePair pair = treeParser.load();\n} catch (ExperimentParserError e) {\n    // e names experimentId and 'compilation unit'; check file integrity, then re-record the log\n}","preventionTips":["Only parse optimization logs from completed JVM runs.","Copy logs atomically (to a temp name, then rename) while the writer may still be active."],"tags":["profdiff","io","optimization-log","parser"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}