{"record":{"id":"b7b489b2351eaa5e","repo":"oracle/graal","slug":"the-argument-s-could-not-be-parsed-s-b7b489","errorCode":null,"errorMessage":"The argument '%s' could not be parsed: %s","messagePattern":"The argument '(.+?)' could not be parsed: (.+?)","errorType":"validation","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/args/IntegerArgument.java","lineNumber":40,"sourceCode":" * or visit www.oracle.com if you need additional information or have any\n * questions.\n */\npackage org.graalvm.profdiff.args;\n\n/**\n * A program argument that holds an integer.\n */\npublic class IntegerArgument extends ValuedArgument<Integer> {\n    public IntegerArgument(String name, int defaultValue, String help) {\n        super(name, defaultValue, help);\n    }\n\n    @Override\n    protected Integer parseValue(String s) throws InvalidArgumentException {\n        try {\n            return Integer.parseInt(s);\n        } catch (NumberFormatException e) {\n            throw new InvalidArgumentException(getName(), e.getMessage());\n        }\n    }\n}\n","sourceCodeStart":22,"sourceCodeEnd":44,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/args/IntegerArgument.java#L22-L44","documentation":"Thrown by IntegerArgument.parseValue when Integer.parseInt raises NumberFormatException; the JDK message is chained into InvalidArgumentException. It marks an int-valued option whose value is not a parsable Java int (including out-of-range values above Integer.MAX_VALUE).","triggerScenarios":"Passing '--some-int=10x', '1e3', '1.0', '' (empty), '2147483648' (overflow), or '1_000' to any integer option of profdiff or a parser built on this package.","commonSituations":"Percentage/threshold flags given floats ('0.5' instead of '1'), values with units or separators, 32-bit overflow from large numbers, empty CI-provided variables.","solutions":["Pass a plain decimal integer within int range, e.g. '--opt 50'.","If you meant a fraction, check the flag's semantics — many thresholds are integer percentages, so use 50 not 0.5.","Sanitize values in scripts: strip units/whitespace and Integer.parseInt-check them first."],"exampleFix":"# before\nmx profdiff normal-tier ... --percentage 0.5\n# after\nmx profdiff normal-tier ... --percentage 50","handlingStrategy":"validation","validationCode":"int i;\ntry { i = Integer.parseInt(value.trim()); } catch (NumberFormatException e) { throw new IllegalArgumentException(\"Not an int: \" + value); }","typeGuard":"static boolean isParsableInt(String s) {\n    if (s == null || s.isEmpty()) return false;\n    try { Integer.parseInt(s); return true; } catch (NumberFormatException e) { return false; }\n}","tryCatchPattern":"try {\n    parser.parse(args);\n} catch (InvalidArgumentException e) {\n    // chained NumberFormatException message identifies the bad integer token\n}","preventionTips":["Pass integer percentages as whole numbers (50, not 0.5 or 50%).","Range-check values against int bounds in wrapper scripts."],"tags":["cli","arguments","number-parsing","integer"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}