NationalSecurityAgency/ghidra · warning · OptionsVetoException
Maximum size of test sets must be positive!
Error message
Maximum size of test sets must be positive!
What it means
Thrown by RandomForestFunctionFinderPlugin.optionsChanged() as an OptionsVetoException when the user sets the 'Maximum size of test sets' option (TEST_SET_MAX_SIZE_OPTION_NAME) to a value <= 0. OptionsVetoException tells the options UI to reject the change and keep the old value. The option is typed as Long.
Source
Thrown at Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java:116
@Override
protected void dispose() {
super.dispose();
if (paramsDialog != null) {
paramsDialog.dispose();
}
}
@Override
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
Object newValue) throws OptionsVetoException {
switch (optionName) {
case TEST_SET_MAX_SIZE_OPTION_NAME:
Long newMax = (Long) newValue;
if (newMax <= 0) {
//does this actually inform the user of the problem?
throw new OptionsVetoException(
TEST_SET_MAX_SIZE_OPTION_NAME + " must be positive!");
}
testSetMax = newMax;
break;
case MIN_UNDEFINED_RANGE_SIZE_OPTION_NAME:
Long newMin = (Long) newValue;
if (newMin <= 0) {
throw new OptionsVetoException(
MIN_UNDEFINED_RANGE_SIZE_OPTION_NAME + " must be positive!");
}
minUndefinedRangeSize = newMin;
break;
default:
Msg.showError(this, null, "Unknown option", "Unknown option: " + optionName);
}
}
/**View on GitHub (pinned to d5f144c24d)
Solutions
- Set the option to a positive integer (default is 1,000,000); e.g. 1000000.
- Validate the value > 0 in the options UI before applying; the veto will already revert it.
- If configuring programmatically, clamp to at least 1 before calling options.setLong(...).
Example fix
// before
options.setLong("Maximum size of test sets", 0); // vetoed
// after
options.setLong("Maximum size of test sets", 1_000_000L); Defensive patterns
Strategy: validation
Validate before calling
long v = options.getLong("Maximum size of test sets", 1_000_000L);
if (v <= 0) v = 1_000_000L; // clamp before any code reads it
// when setting:
if (newMax > 0) options.setLong("Maximum size of test sets", newMax); Type guard
null
Try / catch
try {
options.setLong("Maximum size of test sets", value);
} catch (OptionsVetoException e) {
// option kept its previous value; re-prompt with a positive integer
} Prevention
- Always pass a positive Long when setting the test-set max size.
- Validate > 0 in the option editor before Apply.
- Use the documented default (1,000,000) when unsure.
When it happens
Trigger: Entering 0 or a negative number in the tool options for 'Random Forest Function Finder -> Maximum size of test sets'; programmatic option set to a non-positive Long.
Common situations: User misunderstanding the field as a percentage/ratio and entering 0; clearing the field resulting in a bad value; scripted config pushing an invalid Long.
Related errors
- Minimum Length of Undefined Range to Search must be positive
- Error parsing register=value string {part}
- Register {regName} not found for program {programName}
- Entry cannot be blank
- String must not begin or end with a comma
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/929b760d244b4de4.
Report an issue: GitHub.