{"record":{"id":"790937304c32ddf6","repo":"oracle/graal","slug":"you-should-not-set-the-barista-mode-option-man","errorCode":null,"errorMessage":"You should not set the Barista '--mode' option manually! Found '{mode_match.group(0)}' in the run arguments!","messagePattern":"You should not set the Barista '--mode' option manually! Found '(.+?)' in the run arguments!","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdk/mx.sdk/mx_sdk_benchmark.py","lineNumber":4024,"sourceCode":"            jvm_cmd = cmd\n\n            # Extract the path to the JVM distribution from the JVM command\n            java_exe_pattern = os.path.join(\"^(.*)\", \"bin\", \"java$\")\n            java_exe_match = self._regexFindInCommand(jvm_cmd, java_exe_pattern)\n            if not java_exe_match:\n                raise ValueError(f\"Could not find the path to the java executable in: {jvm_cmd}\")\n\n            # Extract VM options and command prefix from the JVM command\n            index_of_java_exe = jvm_cmd.index(java_exe_match.group(0))\n            jvm_cmd_prefix = jvm_cmd[:index_of_java_exe]\n            jvm_vm_options = jvm_cmd[index_of_java_exe + 1:]\n\n            # Verify that the run arguments don't already contain a \"--mode\" option\n            run_args = suite.runArgs(bm_exec_context().get(\"bm_suite_args\")) + self._energyTrackerExtraOptions(suite)\n            mode_pattern = r\"^(?:-m|--mode)(=.*)?$\"\n            mode_match = self._regexFindInCommand(run_args, mode_pattern)\n            if mode_match:\n                raise ValueError(f\"You should not set the Barista '--mode' option manually! Found '{mode_match.group(0)}' in the run arguments!\")\n\n            # Get bench name and workload to use in the barista harness - we might have custom named benchmarks that need to be mapped\n            barista_bench_name = suite.baristaHarnessBenchmarkName()\n            barista_workload = suite.baristaHarnessBenchmarkWorkload()\n\n            # Construct the Barista command\n            barista_cmd = [str(suite.baristaHarnessPath())]\n            barista_cmd.append(f\"--java-home={java_exe_match.group(1)}\")\n            if barista_workload is not None:\n                barista_cmd.append(f\"--config={barista_workload}\")\n            barista_cmd += run_args\n            if jvm_vm_options:\n                self._updateCommandOption(barista_cmd, \"--vm-options\", \"-v\", \" \".join(jvm_vm_options))\n            if jvm_cmd_prefix:\n                self._updateCommandOption(barista_cmd, \"--cmd-app-prefix\", \"-p\", \" \".join(jvm_cmd_prefix))\n            barista_cmd += [\"--mode\", \"jvm\"]\n            barista_cmd.append(barista_bench_name)\n            return barista_cmd","sourceCodeStart":4006,"sourceCodeEnd":4042,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/sdk/mx.sdk/mx_sdk_benchmark.py#L4006-L4042","documentation":"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.","triggerScenarios":"Passing --mode=javassist or -m or --mode as benchmark run args, e.g. 'mx benchmark barista:... -- --mode=nib'.","commonSituations":"Copy-pasting barista CLI invocations into mx run args; energy-tracker extra options that include a mode flag.","solutions":["Remove the -m/--mode flag from the run arguments; select the mode through the suite's own option if one exists.","If you need a specific mode, use the suite-level knob that the Barista suite maps to --mode internally.","Check _energyTrackerExtraOptions output too, since those options are concatenated before the check."],"exampleFix":"# before\nmx benchmark barista:some-bench -- --mode=nib\n\n# after\nmx benchmark barista:some-bench   # mode chosen by the suite","handlingStrategy":"validation","validationCode":"import re\nmode_pattern = r\"^(?:-m|--mode)(=.*)?$\"\nbad = [a for a in run_args if re.match(mode_pattern, a)]\nassert not bad, f\"remove {bad}: the Barista suite sets --mode itself\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never forward barista CLI flags verbatim into mx run args.","Filter -m/--mode out of user-supplied run args in wrapper scripts before invoking the suite."],"tags":["graalvm","benchmark","barista","options","mx"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}