{"record":{"id":"4312b459301a747e","repo":"oracle/graal","slug":"nargs-not-allowed","errorCode":null,"errorMessage":"nargs not allowed","messagePattern":"nargs not allowed","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"compiler/mx.compiler/mx_compiler.py","lineNumber":800,"sourceCode":"    BootstrapTest('BootstrapWithSystemAssertionsEconomy', _bootstrapFlags + _defaultFlags + _assertionFlags + _graalEconomyFlags + _graalErrorFlags, tags=GraalTags.bootstrapeconomy),\n    BootstrapTest('BootstrapWithSystemAssertionsExceptionEdges', _bootstrapFlags + _defaultFlags + _assertionFlags + _exceptionFlags + _graalErrorFlags, tags=GraalTags.bootstrap),\n    BootstrapTest('BootstrapWithSystemAssertionsRegisterPressure', _bootstrapFlags + _defaultFlags + _assertionFlags + _registerPressureFlags + _graalErrorFlags, tags=GraalTags.bootstrap),\n]\n\n_runs_on_github_actions = 'GITHUB_ACTION' in os.environ\n\ndef _graal_gate_runner(args, tasks):\n    compiler_gate_runner(['compiler', 'truffle'], graal_unit_test_runs, graal_bootstrap_tests, tasks, args.extra_vm_argument, args.extra_unittest_argument)\n    if not _runs_on_github_actions:\n        compiler_gate_benchmark_runner(tasks, args.extra_vm_argument, task_report_component='compiler')\n\nclass ShellEscapedStringAction(argparse.Action):\n    \"\"\"Turns a shell-escaped string into a list of arguments.\n       Note that it appends the result to the destination.\n    \"\"\"\n    def __init__(self, option_strings, nargs=None, **kwargs):\n        if nargs is not None:\n            raise ValueError(\"nargs not allowed\")\n        super().__init__(option_strings, **kwargs)\n\n    def __call__(self, parser, namespace, values, option_string=None):\n        # do not override existing values\n        old_values = getattr(namespace, self.dest)\n        # shlex.split interprets '\\' as an escape char so it needs to be escaped itself\n        values = values.replace(\"\\\\\", \"\\\\\\\\\")\n        setattr(namespace, self.dest, (old_values if old_values else []) + shlex.split(values))\n\nmx_gate.add_gate_runner(_suite, _graal_gate_runner)\nmx_gate.add_gate_argument('--extra-vm-argument', action=ShellEscapedStringAction, help='add extra vm arguments to gate tasks if applicable')\nmx_gate.add_gate_argument('--extra-unittest-argument', action=ShellEscapedStringAction, help='add extra unit test arguments to gate tasks if applicable')\n\ndef _unittest_vm_launcher(vmArgs, mainClass, mainClassArgs):\n    if jdk.tag == 'graalvm':\n        # we do not want to use -server for GraalVM configurations\n        mx.run_java(vmArgs + [mainClass] + mainClassArgs, jdk=jdk)\n    else:","sourceCodeStart":782,"sourceCodeEnd":818,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/mx.compiler/mx_compiler.py#L782-L818","documentation":"DefaultHomeFinder falls back to the java.home system property to locate the GraalVM installation when no explicit GraalVM home was configured. If System.getProperty(\"java.home\") returns null it throws an AssertionError, because the finder assumes a JVM always defines java.home. In practice this only happens on a broken, stripped-down, or manually constructed runtime.","triggerScenarios":"Running on a JVM launched with java.home removed (e.g. -Djava.home cleared via reflection or a custom launcher), inside minimal/custom runtimes where java.home is undefined, or in tests that sanitize system properties and then trigger home lookup (Version.getCurrent(), HomeFinder.findHome()).","commonSituations":"Over-aggressive system-property scrubbing in test harnesses; embedding the SDK in a non-standard launcher; security managers or instrumentation that hide system properties.","solutions":["Do not remove or blank the java.home system property; restore it if a test scrubbed it.","Set an explicit GraalVM home (graalvm.home system property / GRAALVM_HOME env var honored by DefaultHomeFinder) so the java.home fallback path is never taken.","If you control the launcher, ensure it initializes standard system properties like java.home."],"exampleFix":"// before\nSystem.getProperties().remove(\"java.home\");\nVersion v = Version.getCurrent();\n\n// after\n// keep java.home intact, or pin the lookup explicitly:\nSystem.setProperty(\"graalvm.home\", \"/opt/graalvm\");\nVersion v = Version.getCurrent();","handlingStrategy":"validation","validationCode":"if (System.getProperty(\"java.home\") == null) {\n    throw new IllegalStateException(\"java.home is unset; cannot locate GraalVM home\");\n}\nVersion.getCurrent();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never strip java.home in test harnesses or custom launchers.","Set graalvm.home / GRAALVM_HOME explicitly so the java.home fallback is not needed."],"tags":["environment","java-home","system-property","graalvm-sdk"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}