{"record":{"id":"8fc8404f65d8a2bb","repo":"oracle/graal","slug":"invalid-arguments-to-benchmarkdynamiccounters-er","errorCode":null,"errorMessage":"invalid arguments to BenchmarkDynamicCounters: (err|out),start,end,(err|out),start,end,... (~ matches multiple digits)","messagePattern":"invalid arguments to BenchmarkDynamicCounters: \\(err\\|out\\),start,end,\\(err\\|out\\),start,end,\\.\\.\\. \\(~ matches multiple digits\\)","errorType":"validation","errorClass":"GraalError","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/debug/BenchmarkCounters.java","lineNumber":476,"sourceCode":"                        }\n                        break;\n                    case 0:\n                        if (waitingForEnd) {\n                            waitingForEnd = false;\n                            running = false;\n                            try (PrintStreamScope scope = getPrintStream(options)) {\n                                BenchmarkCounters.dump(options, scope.out, (System.nanoTime() - startTime) / 1000000000d, jvmciRuntime.collectCounters(), 100);\n                            }\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());","sourceCodeStart":458,"sourceCodeEnd":494,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/debug/BenchmarkCounters.java#L458-L494","documentation":"GraalError thrown while parsing -Dgraal.BenchmarkDynamicCounters. The option value is a comma-separated list of triples (err|out, startPattern, endPattern); splitting on ',' must yield a non-empty list whose length is a multiple of 3. This check enforces the triple structure before any stream is wrapped.","triggerScenarios":"Setting -Dgraal.BenchmarkDynamicCounters with a value whose comma-separated token count is not divisible by 3, e.g. 'err,1' or 'err,1,~,out,2' (5 tokens), or an empty-ish value.","commonSituations":"Hand-writing the option in benchmark scripts and forgetting one field of a triple; adding a second triple but omitting its end pattern; trailing/missing commas after edits.","solutions":["Rewrite the value as complete triples: '(err|out),start,end' repeated, e.g. -Dgraal.BenchmarkDynamicCounters='err,1,~'.","Count tokens: total comma-separated fields must be exactly 3 per triple.","Use '~' as a digit wildcard in start/end when matching multiple digits."],"exampleFix":"# before\n-Dgraal.BenchmarkDynamicCounters=err,1\n\n# after\n-Dgraal.BenchmarkDynamicCounters=err,1,~","handlingStrategy":"validation","validationCode":"String v = System.getProperty(\"graal.BenchmarkDynamicCounters\", \"\");\nif (!v.isEmpty()) {\n    String[] toks = v.split(\",\");\n    if (toks.length == 0 || toks.length % 3 != 0) {\n        throw new IllegalArgumentException(\"BenchmarkDynamicCounters must be (err|out),start,end triples: \" + v);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build the option value programmatically by joining complete triples rather than string-concatenating fragments.","Unit-test flag-generation code that emits BenchmarkDynamicCounters."],"tags":["graalvm","benchmarking","configuration","arguments"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}