NationalSecurityAgency/ghidra · warning · OptionsVetoException

Minimum Length of Undefined Range to Search must be positive

Error message

Minimum Length of Undefined Range to Search must be positive!

What it means

Thrown by RandomForestFunctionFinderPlugin.optionsChanged() as an OptionsVetoException when the 'Minimum Length of Undefined Range to Search' option (MIN_UNDEFINED_RANGE_SIZE_OPTION_NAME) is set to a value <= 0. Like the test-set option it is a Long and the veto keeps the previous valid value.

Source

Thrown at Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java:124

	}

	@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);
		}
	}

	/**
	 * Record the existence of a {@link ProgramAssociatedComponentProviderAdapter} so that it can
	 * be closed if its associated program is closed
	 * @param provider provider
	 */
	void addProvider(ProgramAssociatedComponentProviderAdapter provider) {
		List<ProgramAssociatedComponentProviderAdapter> providers =
			programsToProviders.computeIfAbsent(provider.getProgram(), p -> new ArrayList<>());
		providers.add(provider);

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Set the option to a positive integer (default is 16); e.g. 16.
  2. Validate > 0 in the UI before applying; the veto reverts invalid values automatically.
  3. Programmatically, ensure the Long passed is >= 1.

Example fix

// before
options.setLong("Minimum Length of Undefined Range to Search", 0); // vetoed

// after
options.setLong("Minimum Length of Undefined Range to Search", 16L);
Defensive patterns

Strategy: validation

Validate before calling

long v = options.getLong("Minimum Length of Undefined Range to Search", 16L);
if (v <= 0) v = 16L;
if (newMin > 0) options.setLong("Minimum Length of Undefined Range to Search", newMin);

Type guard

null

Try / catch

try {
    options.setLong("Minimum Length of Undefined Range to Search", value);
} catch (OptionsVetoException e) {
    // previous value retained; prompt for a positive integer
}

Prevention

When it happens

Trigger: Entering 0 or negative for 'Minimum Length of Undefined Range to Search' in the plugin options; programmatic set with a non-positive Long.

Common situations: User clearing the field or entering 0 thinking it disables the minimum; mis-typed value; scripted defaults pushed wrong.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/d032391d54f023d7. Report an issue: GitHub.