NationalSecurityAgency/ghidra · error · IllegalArgumentException
Invalid int %s. Prefixes 0x, 0b, and 0 (octal) are allowed.
Error message
Invalid int %s. Prefixes 0x, 0b, and 0 (octal) are allowed.
What it means
Thrown as IllegalArgumentException by the INT BaseType decoder when NumericUtilities.decodeBigInteger(str) raises NumberFormatException. The decoder accepts decimal, 0x-hex, 0b-binary, and 0-octal prefixes; anything else (floats, text, unrecognized prefixes) is rejected. This usually surfaces wrapped by error 353's ParseException at the call site.
Source
Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java:189
@Override
public String decode(String str) {
return str;
}
};
public static final BaseType<BigInteger> INT = new BaseType<>() {
@Override
public Class<BigInteger> cls() {
return BigInteger.class;
}
@Override
public BigInteger decode(String str) {
try {
return NumericUtilities.decodeBigInteger(str);
}
catch (NumberFormatException e) {
throw new IllegalArgumentException(
"Invalid int %s. Prefixes 0x, 0b, and 0 (octal) are allowed."
.formatted(str));
}
}
};
public static final BaseType<Boolean> BOOL = new BaseType<>() {
@Override
public Class<Boolean> cls() {
return Boolean.class;
}
@Override
public Boolean decode(String str) {
Boolean result = switch (str.trim().toLowerCase()) {
case "true" -> true;
case "false" -> false;
default -> null;View on GitHub (pinned to d5f144c24d)
Solutions
- Use a valid integer literal: decimal (123), hex (0x1F90), binary (0b1010), or octal (017).
- Remove decimal points, suffixes, and non-numeric characters from the value.
- If a default of zero is intended, write '0' explicitly rather than leaving it blank.
Example fix
# before #@env COUNT:int=1.5 # throws 'Invalid int 1.5 ...' # after #@env COUNT:int=2
Defensive patterns
Strategy: validation
Validate before calling
try { NumericUtilities.decodeBigInteger(str); }
catch (NumberFormatException e) { /* reject before declaring the parameter */ } Type guard
boolean isValidInt(String s) {
try { NumericUtilities.decodeBigInteger(s); return true; }
catch (NumberFormatException e) { return false; }
} Prevention
- Use decimal, 0x, 0b, or 0-prefixed integer literals only.
- Avoid decimals, suffixes, and whitespace in int parameter values.
- Validate int defaults when authoring launcher scripts.
When it happens
Trigger: Declaring or supplying an int parameter value like '1.5', 'abc', '0xGHI', or an empty string. NumericUtilities.decodeBigInteger only accepts the documented prefix forms.
Common situations: A default value with a decimal point for an int parameter; a stray non-numeric character; using 'h' or other suffixes; an empty value where the script author assumed zero.
Related errors
- %s: Invalid type %s
- %s: %s
- %s: Invalid base type %s
- Invalid bool for %s: %s. Only true or false is allowed.
- Transaction already started
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/7cb1d1edab2338f6.
Report an issue: GitHub.