{"record":{"id":"1f83018d83527b2b","repo":"oracle/graal","slug":"setting-the-vm-option-dnative-image-benchmark-st","errorCode":null,"errorMessage":"Setting the VM option '-Dnative-image.benchmark.stages' is not supported when using {self.__class__.__name__} as a dispatcher!","messagePattern":"Setting the VM option '-Dnative-image\\.benchmark\\.stages' is not supported when using (.+?) as a dispatcher!","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdk/mx.sdk/mx_sdk_benchmark.py","lineNumber":5858,"sourceCode":"                    if self.fork_count != 1:\n                        mx.log(f\"Running fork {i+1}/{self.fork_count}.\")\n                    yield BenchmarkExecutionConfiguration(supported_benchmarks, self.state.mx_benchmark_args, JMHNativeImageDispatcher._inject_stage_arg(suite_args, str(StageName.RUN)), ForkInfo(i, self.fork_count))\n\n    def _get_pre_run_stages(self) -> list[Stage]:\n        vm = self.suite.get_vm_registry().get_vm_from_suite_args(self.state.bm_suite_args)\n        effective_stages, _ = vm.prepare_stages(self.suite, self.state.bm_suite_args)\n        return [stage for stage in effective_stages if stage.stage_name != StageName.RUN]\n\n    @staticmethod\n    def _inject_stage_arg(bm_suite_args: list[str], stage_name: str) -> list[str]:\n        stage = Stage.from_string(stage_name)\n        return [f\"-Dnative-image.benchmark.stages={stage}\"] + bm_suite_args\n\n    def _verify_stages_not_explicitly_requested(self):\n        vm_args = self.state.suite.vmArgs(self.state.bm_suite_args)\n        if len(parse_prefixed_args(\"-Dnative-image.benchmark.stages=\", vm_args)) > 0:\n            msg = f\"Setting the VM option '-Dnative-image.benchmark.stages' is not supported when using {self.__class__.__name__} as a dispatcher!\"\n            raise ValueError(msg)\n","sourceCodeStart":5840,"sourceCodeEnd":5859,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/sdk/mx.sdk/mx_sdk_benchmark.py#L5840-L5859","documentation":"Some native-image benchmark dispatchers iterate over pipeline stages themselves and inject '-Dnative-image.benchmark.stages=<stage>' per stage. If the user already set that VM option explicitly, the dispatcher's injection would conflict, so _verify_stages_not_explicitly_requested() raises ValueError naming the dispatcher class.","triggerScenarios":"Combining a multi-stage dispatcher (e.g. one that runs each native-image benchmark stage separately) with an explicit -Dnative-image.benchmark.stages=... in the VM args of the benchmark command.","commonSituations":"Reusing a command line written for the non-dispatcher path; CI configs that hard-code the stages property.","solutions":["Remove -Dnative-image.benchmark.stages=... from your VM options and let the dispatcher select stages.","If you need stage selection, use the dispatcher's own stage-selection mechanism (e.g. its stage filter arguments) instead of the VM option.","Search your full command line, including --J/@-file args, for the property; it is parsed out of vmArgs."],"exampleFix":"# before\nmx benchmark ... -- -Dnative-image.benchmark.stages=run   # dispatcher also sets it\n\n# after\nmx benchmark ...   # dispatcher injects the stage property per stage","handlingStrategy":"validation","validationCode":"from mx_sdk_benchmark import parse_prefixed_args\nhits = parse_prefixed_args(\"-Dnative-image.benchmark.stages=\", vm_args)\nassert not hits, \"drop the explicit stages property; the dispatcher sets it per stage\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep dispatcher-based benchmark commands free of pipeline-stage VM options.","Audit @-file / --J option bundles for the stages property when this fires.","Prefer the dispatcher's own stage-filter arguments over the raw property."],"tags":["graalvm","benchmark","native-image","options","mx"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}