oracle/graal · error · ValueError

You should not set the Barista '--mode' option manually! Fou

Error message

You should not set the Barista '--mode' option manually! Found '{mode_match.group(0)}' in the run arguments!

What it means

The Barista harness command is constructed programmatically and the suite injects '--mode' itself. If the user's run arguments already contain -m/--mode (matched by '^(?:-m|--mode)(=.*)?$'), the suite refuses to run to avoid a duplicate/conflicting option.

Source

Thrown at sdk/mx.sdk/mx_sdk_benchmark.py:4024

            jvm_cmd = cmd

            # Extract the path to the JVM distribution from the JVM command
            java_exe_pattern = os.path.join("^(.*)", "bin", "java$")
            java_exe_match = self._regexFindInCommand(jvm_cmd, java_exe_pattern)
            if not java_exe_match:
                raise ValueError(f"Could not find the path to the java executable in: {jvm_cmd}")

            # Extract VM options and command prefix from the JVM command
            index_of_java_exe = jvm_cmd.index(java_exe_match.group(0))
            jvm_cmd_prefix = jvm_cmd[:index_of_java_exe]
            jvm_vm_options = jvm_cmd[index_of_java_exe + 1:]

            # Verify that the run arguments don't already contain a "--mode" option
            run_args = suite.runArgs(bm_exec_context().get("bm_suite_args")) + self._energyTrackerExtraOptions(suite)
            mode_pattern = r"^(?:-m|--mode)(=.*)?$"
            mode_match = self._regexFindInCommand(run_args, mode_pattern)
            if mode_match:
                raise ValueError(f"You should not set the Barista '--mode' option manually! Found '{mode_match.group(0)}' in the run arguments!")

            # Get bench name and workload to use in the barista harness - we might have custom named benchmarks that need to be mapped
            barista_bench_name = suite.baristaHarnessBenchmarkName()
            barista_workload = suite.baristaHarnessBenchmarkWorkload()

            # Construct the Barista command
            barista_cmd = [str(suite.baristaHarnessPath())]
            barista_cmd.append(f"--java-home={java_exe_match.group(1)}")
            if barista_workload is not None:
                barista_cmd.append(f"--config={barista_workload}")
            barista_cmd += run_args
            if jvm_vm_options:
                self._updateCommandOption(barista_cmd, "--vm-options", "-v", " ".join(jvm_vm_options))
            if jvm_cmd_prefix:
                self._updateCommandOption(barista_cmd, "--cmd-app-prefix", "-p", " ".join(jvm_cmd_prefix))
            barista_cmd += ["--mode", "jvm"]
            barista_cmd.append(barista_bench_name)
            return barista_cmd

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Remove the -m/--mode flag from the run arguments; select the mode through the suite's own option if one exists.
  2. If you need a specific mode, use the suite-level knob that the Barista suite maps to --mode internally.
  3. Check _energyTrackerExtraOptions output too, since those options are concatenated before the check.

Example fix

# before
mx benchmark barista:some-bench -- --mode=nib

# after
mx benchmark barista:some-bench   # mode chosen by the suite
Defensive patterns

Strategy: validation

Validate before calling

import re
mode_pattern = r"^(?:-m|--mode)(=.*)?$"
bad = [a for a in run_args if re.match(mode_pattern, a)]
assert not bad, f"remove {bad}: the Barista suite sets --mode itself"

Prevention

When it happens

Trigger: Passing --mode=javassist or -m or --mode as benchmark run args, e.g. 'mx benchmark barista:... -- --mode=nib'.

Common situations: Copy-pasting barista CLI invocations into mx run args; energy-tracker extra options that include a mode flag.

Related errors


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