oracle/graal · error · ExperimentParserError

Failed to parse experiment {experimentId} in {resource}: mis

Error message

Failed to parse experiment {experimentId} in {resource}: mismatched experiment kind: expected {expected}, got{actual}

What it means

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.

Source

Thrown at compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/ExperimentParser.java:202

     * Parses the experiment by combining proftool output and an optimization log. The optimization
     * log is read first and all compiled methods are parsed. The proftool output is then used to
     * add information about execution periods. Method compilations from the optimization log are
     * matched with the proftool output according to compilation IDs. Warning messages are printed
     * using the provided writer.
     *
     * @return the parsed experiment
     * @throws IOException failed to read the experiment files
     * @throws ExperimentParserTypeError the experiment files had an in incorrect format
     */
    public Experiment parse() throws IOException, ExperimentParserError {
        List<PartialCompilationUnit> partialCompilationUnits = parsePartialCompilationUnits();
        Experiment experiment;
        Optional<FileView> proftoolLogFile = experimentFiles.getProftoolOutput();
        if (proftoolLogFile.isPresent()) {
            FileView logFileView = proftoolLogFile.get();
            ProftoolLog proftoolLog = parseProftoolLog(logFileView);
            if (experimentFiles.getCompilationKind() != null && proftoolLog.compilationKind != experimentFiles.getCompilationKind()) {
                throw new ExperimentParserError(experimentFiles.getExperimentId(), logFileView.getSymbolicPath(),
                                "mismatched experiment kind: expected " + experimentFiles.getCompilationKind() + ", got" + proftoolLog.compilationKind);
            }
            switch (proftoolLog.compilationKind) {
                case JIT -> linkJITProfilesToCompilationUnits(partialCompilationUnits, proftoolLog);
                case AOT -> linkAOTProfilesToCompilationUnits(partialCompilationUnits, proftoolLog);
            }
            experiment = new Experiment(
                            proftoolLog.executionId,
                            experimentFiles.getExperimentId(),
                            proftoolLog.compilationKind,
                            proftoolLog.totalPeriod,
                            proftoolLog.methods);
        } else {
            experiment = new Experiment(experimentFiles.getExperimentId(), experimentFiles.getCompilationKind());
        }
        for (PartialCompilationUnit unit : partialCompilationUnits) {
            CompilationUnitTreeParser treeParser = new CompilationUnitTreeParser(experimentFiles.getExperimentId(), unit.fileView);
            experiment.addCompilationUnit(unit.methodName, unit.compilationId, unit.period, treeParser);

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Set the compilation-kind flag for each experiment to match how its proftool data was recorded (JIT vs AOT).
  2. Re-record the proftool output if the run itself used the other mode.
  3. Double-check that each --proftoolN path belongs to the correspondingly declared experiment.

Example fix

# before
mx profdiff normal-tier --experiment1 a --proftool1 proftool-aot.json --aot1 ... # kind mismatch
# after
mx profdiff normal-tier --experiment1 a --proftool1 proftool-jit.json # or declare --aot1 with an AOT log
Defensive patterns

Strategy: validation

Validate before calling

// Read the kind from the log and compare with the declared kind before full parse
String kind = readCompilationKindFromProftoolLog(path); // "jit"/"aot" per log schema
if (declaredKind != null && !declaredKind.equals(kind)) {
    throw new IllegalArgumentException("Log kind " + kind + " does not match declared " + declaredKind);
}

Try / catch

try {
    ExperimentParser.parseOrPanic(...);
} catch (RuntimeException e) {
    if (e.getMessage().contains("mismatched experiment kind")) { /* fix the kind flag or the log */ }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/1dd45027df196c37. Report an issue: GitHub.