{"record":{"id":"f5dda3539524ad5d","repo":"oracle/graal","slug":"invalid-arguments-to-benchmarkdynamiccounters-err","errorCode":null,"errorMessage":"invalid arguments to BenchmarkDynamicCounters: err|out","messagePattern":"invalid arguments to BenchmarkDynamicCounters: err\\|out","errorType":"validation","errorClass":"GraalError","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/debug/BenchmarkCounters.java","lineNumber":484,"sourceCode":"                            }\n                        }\n                        break;\n                }\n            }\n        }\n\n        if (Options.BenchmarkDynamicCounters.getValue(options) != null) {\n            String[] arguments = Options.BenchmarkDynamicCounters.getValue(options).split(\",\");\n            if (arguments.length == 0 || (arguments.length % 3) != 0) {\n                throw new GraalError(\"invalid arguments to BenchmarkDynamicCounters: (err|out),start,end,(err|out),start,end,... (~ matches multiple digits)\");\n            }\n            for (int i = 0; i < arguments.length; i += 3) {\n                if (arguments[i].equals(\"err\")) {\n                    System.setErr(new PrintStream(new BenchmarkCountersOutputStream(System.err, arguments[i + 1], arguments[i + 2])));\n                } else if (arguments[i].equals(\"out\")) {\n                    System.setOut(new PrintStream(new BenchmarkCountersOutputStream(System.out, arguments[i + 1], arguments[i + 2])));\n                } else {\n                    throw new GraalError(\"invalid arguments to BenchmarkDynamicCounters: err|out\");\n                }\n            }\n            enabled = true;\n        }\n        if (Options.GenericDynamicCounters.getValue(options)) {\n            enabled = true;\n        }\n        if (Options.TimedDynamicCounters.getValue(options) > 0) {\n            if (LibGraalSupport.inLibGraalRuntime()) {\n                throw new GraalError(\"Use of %s is only supported in jargraal\", Options.TimedDynamicCounters.getName());\n            }\n            Thread thread = new Thread(new Runnable() {\n                long lastTime = System.nanoTime();\n\n                @Override\n                public void run() {\n                    try (PrintStreamScope scope = getPrintStream(options)) {\n                        while (true) { // TERMINATION ARGUMENT: busy waiting loop","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/debug/BenchmarkCounters.java#L466-L502","documentation":"GraalError thrown while parsing -Dgraal.BenchmarkDynamicCounters: the arity check passed, but the first token of a triple is neither 'err' nor 'out'. Those two literals are the only supported stream selectors (stderr/stdout respectively); anything else cannot be bound to a counting PrintStream.","triggerScenarios":"Passing a triple whose first element is invalid, e.g. -Dgraal.BenchmarkDynamicCounters='both,1,~' or 'stdout,1,~' — note it must be exactly 'err' or 'out', case-sensitive.","commonSituations":"Writing 'stdout'/'stderr' in full instead of 'out'/'err'; uppercasing the token; copy-paste from docs that paraphrase the syntax.","solutions":["Use exactly 'err' or 'out' (lowercase) as the first token of every triple.","Double-check the value parses as triples before launching, e.g. echo \"$V\" | awk -F, 'NF%3!=0{exit 1}'."],"exampleFix":"# before\n-Dgraal.BenchmarkDynamicCounters=stdout,1,~\n\n# after\n-Dgraal.BenchmarkDynamicCounters=out,1,~","handlingStrategy":"validation","validationCode":"String[] toks = System.getProperty(\"graal.BenchmarkDynamicCounters\", \"\").split(\",\");\nfor (int i = 0; i < toks.length; i += 3) {\n    if (!toks[i].equals(\"err\") && !toks[i].equals(\"out\")) {\n        throw new IllegalArgumentException(\"Triple \" + (i / 3) + \" stream must be 'err' or 'out': \" + toks[i]);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the literal tokens are 'err'/'out' — never 'stdout'/'stderr'.","Validate the whole option string in test harness config loaders before the JVM launches."],"tags":["graalvm","benchmarking","configuration","arguments"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}