oracle/graal · error · InvalidArgumentException

The argument '%s' could not be parsed: %s

Error message

The argument '%s' could not be parsed: %s

What it means

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).

Source

Thrown at compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/args/IntegerArgument.java:40

 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */
package org.graalvm.profdiff.args;

/**
 * A program argument that holds an integer.
 */
public class IntegerArgument extends ValuedArgument<Integer> {
    public IntegerArgument(String name, int defaultValue, String help) {
        super(name, defaultValue, help);
    }

    @Override
    protected Integer parseValue(String s) throws InvalidArgumentException {
        try {
            return Integer.parseInt(s);
        } catch (NumberFormatException e) {
            throw new InvalidArgumentException(getName(), e.getMessage());
        }
    }
}

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Pass a plain decimal integer within int range, e.g. '--opt 50'.
  2. If you meant a fraction, check the flag's semantics — many thresholds are integer percentages, so use 50 not 0.5.
  3. Sanitize values in scripts: strip units/whitespace and Integer.parseInt-check them first.

Example fix

# before
mx profdiff normal-tier ... --percentage 0.5
# after
mx profdiff normal-tier ... --percentage 50
Defensive patterns

Strategy: validation

Validate before calling

int i;
try { i = Integer.parseInt(value.trim()); } catch (NumberFormatException e) { throw new IllegalArgumentException("Not an int: " + value); }

Type guard

static boolean isParsableInt(String s) {
    if (s == null || s.isEmpty()) return false;
    try { Integer.parseInt(s); return true; } catch (NumberFormatException e) { return false; }
}

Try / catch

try {
    parser.parse(args);
} catch (InvalidArgumentException e) {
    // chained NumberFormatException message identifies the bad integer token
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/b7b489b2351eaa5e. Report an issue: GitHub.