NationalSecurityAgency/ghidra · error · IllegalArgumentException
Invalid integer value specified for {}
Error message
Invalid integer value specified for {} What it means
Thrown by parsePositiveIntegerOption when Integer.valueOf raises NumberFormatException because the option value is not a parseable integer. The catch block wraps it in this IllegalArgumentException.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java:375
throw new IllegalArgumentException("Missing required parameter: " + name);
}
String p = params[index];
if (p.startsWith("--")) {
throw new IllegalArgumentException(
"Missing required parameter (" + name + ") before specified option: " + p);
}
}
private int parsePositiveIntegerOption(String option, String optionValue) {
try {
int value = Integer.valueOf(optionValue);
if (value < 0) {
throw new IllegalArgumentException("Negative value not permitted for " + option);
}
return value;
}
catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid integer value specified for " + option);
}
}
/**
* Verify that the given file is a PEM certificate
* @param testFile the file to test
* @return true if testFile looks like a PEM certificate
* @throws IOException if there is a problem reading the given file
*/
private static boolean verifyPEMFormat(File testFile) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(testFile));
try {
// All we currently do is search for the certificate header in the first 200 lines
for (int i = 0; i < 200; ++i) {
String line = reader.readLine();
if (line == null) {
break;
}View on GitHub (pinned to d5f144c24d)
Solutions
- Provide a plain decimal integer string with no extra characters.
- Strip whitespace/units from the value before passing.
- Validate the value is numeric in the calling script before invoking the tool.
Example fix
// before bsim control configure host --port abc // after bsim control configure host --port 5432
Defensive patterns
Strategy: validation
Validate before calling
// Ensure the value is a clean integer string before launch.
String trimmed = portValue == null ? "" : portValue.trim();
if (!trimmed.matches("\\d+")) {
System.err.println("Invalid integer for port: " + portValue);
return;
} Try / catch
try {
launchable.parsePositiveIntegerOption(option, value);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Invalid integer value")) {
System.err.println(option + " needs a plain integer, got: " + value);
}
throw e;
} Prevention
- Pre-validate integer strings with a numeric regex before invoking.
- Trim whitespace and strip units from values in scripts.
- Avoid locale-specific number formatting in CLI arguments.
When it happens
Trigger: Passing a non-numeric or non-integer string such as `--port abc`, `--port 5432.0`, or `--port " 5432"` (line 375).
Common situations: Non-numeric config values, trailing whitespace or units (e.g. '5432 '), float strings, or locale-specific formatting.
Related errors
- Unknown command: {}
- Unsupported command: {}
- Unsupported option use: {}
- Unexpected argument: {}
- Unsupported option specification: {}=
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/3323f97bebf725e5.
Report an issue: GitHub.