oracle/graal · error · TypeError
unexpected tuple size for jvmci variant {variant} (size must
Error message
unexpected tuple size for jvmci variant {variant} (size must be <= 4) What it means
mx SDK benchmark harness error raised when registering JVMCI VM variants: each variant tuple in suite configuration must have 2, 3, or 4 elements (name, args[, priority[, compiler_config]]). A tuple of any other length is a configuration-authoring mistake and raises TypeError immediately during add_vm suite setup.
Source
Thrown at sdk/mx.sdk/mx_sdk_benchmark.py:220
if hosted:
prefixes.append(('hosted-', ['-XX:-UseJVMCICompiler']))
for prefix, args in prefixes:
extended_raw_config_name = prefix + raw_config_name
extended_extra_args = extra_args + args
if include_default:
mx_benchmark.add_java_vm(
JvmciJdkVm(raw_name, extended_raw_config_name, extended_extra_args), suite, priority)
for variant in variants:
compiler_config = None
if len(variant) == 2:
var_name, var_args = variant
var_priority = priority
elif len(variant) == 3:
var_name, var_args, var_priority = variant
elif len(variant) == 4:
var_name, var_args, var_priority, compiler_config = variant
else:
raise TypeError(f"unexpected tuple size for jvmci variant {variant} (size must be <= 4)")
variant_args = extended_extra_args + var_args
if compiler_config is not None:
variant_args = add_or_replace_arg('-Djdk.graal.CompilerConfiguration', compiler_config, variant_args)
mx_benchmark.add_java_vm(
JvmciJdkVm(raw_name, extended_raw_config_name + '-' + var_name, variant_args), suite, var_priority)
class GraalVm(mx_benchmark.OutputCapturingJavaVm):
def __init__(self, name, config_name, extra_java_args, extra_launcher_args):
"""
:type name: str
:type config_name: str
:type extra_java_args: list[str] | None
:type extra_launcher_args: list[str] | None
"""
super().__init__()View on GitHub (pinned to a66e9ccd1d)
Solutions
- Inspect the variants list passed to the JVMCI registration and fix each entry to (name, args), (name, args, priority), or (name, args, priority, compiler_config).
- Check for accidental trailing commas ('graal',) that create 1-tuples.
- If you need a new field, extend the branch chain in mx_sdk_benchmark.py itself rather than appending extra tuple elements.
Example fix
# before
variants = [('graal', '-XX:+UseJVMCICompiler', 1, 'community', 'extra')]
# after
variants = [('graal', '-XX:+UseJVMCICompiler', 1, 'community')] Defensive patterns
Strategy: validation
Validate before calling
def validate_variants(variants):
for v in variants:
if not isinstance(v, tuple) or len(v) not in (2, 3, 4):
raise ValueError(f"bad jvmci variant tuple: {v!r} (need len 2-4)")
return variants Type guard
def is_valid_jvmci_variant(v) -> bool:
return isinstance(v, tuple) and len(v) in (2, 3, 4) and isinstance(v[0], str) and isinstance(v[1], (str, list)) Try / catch
Wrap suite registration in try/except TypeError during config loading and report the offending tuple to the user; fail fast at config parse time rather than mid-benchmark.
Prevention
- Validate variant tuples in a unit test for your suite config.
- Watch for trailing commas creating 1-tuples.
- Document the accepted shapes (2/3/4 elements) next to the variants list.
When it happens
Trigger: Calling the JVMCI VM registration helper with a variants list containing a 1-element or 5+-element tuple, e.g. variants = [('graal',), ...] or ('name', args, priority, config, extra). Trips before any benchmark runs, during mx benchmark suite initialization.
Common situations: Editing mx_sdk_benchmark-style suite definitions or suite.py benchmark configs in a downstream GraalVM distribution; typo like a trailing comma creating a 1-tuple, or passing a list instead of tuple so len() is wrong.
Related errors
- Native Image benchmarks do not support additional options, b
- GraalHost toolchain library directory '{toolchain_lib_path}'
- LogFile substitution %s cannot be combined with any other ch
- too many counters, reduce number of counters or increase -XX
- Launcher '{self.launcher}' does not resolve to an executable
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/58a06451f72cf76a.
Report an issue: GitHub.