{"record":{"id":"1dd45027df196c37","repo":"oracle/graal","slug":"failed-to-parse-experiment-experimentid-in-reso-1dd450","errorCode":null,"errorMessage":"Failed to parse experiment {experimentId} in {resource}: mismatched experiment kind: expected {expected}, got{actual}","messagePattern":"Failed to parse experiment (.+?) in (.+?): mismatched experiment kind: expected (.+?), got(.+?)","errorType":"exception","errorClass":"ExperimentParserError","httpStatus":null,"severity":"error","filePath":"compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/ExperimentParser.java","lineNumber":202,"sourceCode":"     * Parses the experiment by combining proftool output and an optimization log. The optimization\n     * log is read first and all compiled methods are parsed. The proftool output is then used to\n     * add information about execution periods. Method compilations from the optimization log are\n     * matched with the proftool output according to compilation IDs. Warning messages are printed\n     * using the provided writer.\n     *\n     * @return the parsed experiment\n     * @throws IOException failed to read the experiment files\n     * @throws ExperimentParserTypeError the experiment files had an in incorrect format\n     */\n    public Experiment parse() throws IOException, ExperimentParserError {\n        List<PartialCompilationUnit> partialCompilationUnits = parsePartialCompilationUnits();\n        Experiment experiment;\n        Optional<FileView> proftoolLogFile = experimentFiles.getProftoolOutput();\n        if (proftoolLogFile.isPresent()) {\n            FileView logFileView = proftoolLogFile.get();\n            ProftoolLog proftoolLog = parseProftoolLog(logFileView);\n            if (experimentFiles.getCompilationKind() != null && proftoolLog.compilationKind != experimentFiles.getCompilationKind()) {\n                throw new ExperimentParserError(experimentFiles.getExperimentId(), logFileView.getSymbolicPath(),\n                                \"mismatched experiment kind: expected \" + experimentFiles.getCompilationKind() + \", got\" + proftoolLog.compilationKind);\n            }\n            switch (proftoolLog.compilationKind) {\n                case JIT -> linkJITProfilesToCompilationUnits(partialCompilationUnits, proftoolLog);\n                case AOT -> linkAOTProfilesToCompilationUnits(partialCompilationUnits, proftoolLog);\n            }\n            experiment = new Experiment(\n                            proftoolLog.executionId,\n                            experimentFiles.getExperimentId(),\n                            proftoolLog.compilationKind,\n                            proftoolLog.totalPeriod,\n                            proftoolLog.methods);\n        } else {\n            experiment = new Experiment(experimentFiles.getExperimentId(), experimentFiles.getCompilationKind());\n        }\n        for (PartialCompilationUnit unit : partialCompilationUnits) {\n            CompilationUnitTreeParser treeParser = new CompilationUnitTreeParser(experimentFiles.getExperimentId(), unit.fileView);\n            experiment.addCompilationUnit(unit.methodName, unit.compilationId, unit.period, treeParser);","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/ExperimentParser.java#L184-L220","documentation":"ExperimentParser.parse cross-checks the compilation kind recorded in the proftool log against the kind configured for the experiment files (e.g. from the command line). If they differ — the log says JIT but the configuration says AOT, or vice versa — it throws ExperimentParserError('mismatched experiment kind: expected X, got Y') for that experiment and file.","triggerScenarios":"Passing --proftoolN output recorded for a JIT run while declaring the experiment AOT (or omitting/missetting the kind flag so the default clashes), or mixing one experiment's proftool file with another experiment's declared kind.","commonSituations":"Comparing a JIT experiment with an AOT (native-image) experiment where each must be declared with the correct compilation kind; scripts reusing old flag sets after switching to native-image runs; copy-paste of paths between --proftool1 and --proftool2 blocks.","solutions":["Set the compilation-kind flag for each experiment to match how its proftool data was recorded (JIT vs AOT).","Re-record the proftool output if the run itself used the other mode.","Double-check that each --proftoolN path belongs to the correspondingly declared experiment."],"exampleFix":"# before\nmx profdiff normal-tier --experiment1 a --proftool1 proftool-aot.json --aot1 ... # kind mismatch\n# after\nmx profdiff normal-tier --experiment1 a --proftool1 proftool-jit.json # or declare --aot1 with an AOT log","handlingStrategy":"validation","validationCode":"// Read the kind from the log and compare with the declared kind before full parse\nString kind = readCompilationKindFromProftoolLog(path); // \"jit\"/\"aot\" per log schema\nif (declaredKind != null && !declaredKind.equals(kind)) {\n    throw new IllegalArgumentException(\"Log kind \" + kind + \" does not match declared \" + declaredKind);\n}","typeGuard":null,"tryCatchPattern":"try {\n    ExperimentParser.parseOrPanic(...);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"mismatched experiment kind\")) { /* fix the kind flag or the log */ }\n}","preventionTips":["Declare the compilation kind per experiment exactly as recorded (JIT vs AOT).","Do not reuse one experiment's flags for a differently-compiled run."],"tags":["profdiff","configuration","jit","aot"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}