{"record":{"id":"d032391d54f023d7","repo":"NationalSecurityAgency/ghidra","slug":"minimum-length-of-undefined-range-to-search-must-b","errorCode":null,"errorMessage":"Minimum Length of Undefined Range to Search must be positive!","messagePattern":"Minimum Length of Undefined Range to Search must be positive!","errorType":"validation","errorClass":"OptionsVetoException","httpStatus":null,"severity":"warning","filePath":"Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java","lineNumber":124,"sourceCode":"\t}\n\n\t@Override\n\tpublic void optionsChanged(ToolOptions options, String optionName, Object oldValue,\n\t\t\tObject newValue) throws OptionsVetoException {\n\t\tswitch (optionName) {\n\t\t\tcase TEST_SET_MAX_SIZE_OPTION_NAME:\n\t\t\t\tLong newMax = (Long) newValue;\n\t\t\t\tif (newMax <= 0) {\n\t\t\t\t\t//does this actually inform the user of the problem?\n\t\t\t\t\tthrow new OptionsVetoException(\n\t\t\t\t\t\tTEST_SET_MAX_SIZE_OPTION_NAME + \" must be positive!\");\n\t\t\t\t}\n\t\t\t\ttestSetMax = newMax;\n\t\t\t\tbreak;\n\t\t\tcase MIN_UNDEFINED_RANGE_SIZE_OPTION_NAME:\n\t\t\t\tLong newMin = (Long) newValue;\n\t\t\t\tif (newMin <= 0) {\n\t\t\t\t\tthrow new OptionsVetoException(\n\t\t\t\t\t\tMIN_UNDEFINED_RANGE_SIZE_OPTION_NAME + \" must be positive!\");\n\t\t\t\t}\n\t\t\t\tminUndefinedRangeSize = newMin;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tMsg.showError(this, null, \"Unknown option\", \"Unknown option: \" + optionName);\n\t\t}\n\t}\n\n\t/**\n\t * Record the existence of a {@link ProgramAssociatedComponentProviderAdapter} so that it can\n\t * be closed if its associated program is closed\n\t * @param provider provider\n\t */\n\tvoid addProvider(ProgramAssociatedComponentProviderAdapter provider) {\n\t\tList<ProgramAssociatedComponentProviderAdapter> providers =\n\t\t\tprogramsToProviders.computeIfAbsent(provider.getProgram(), p -> new ArrayList<>());\n\t\tproviders.add(provider);","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java#L106-L142","documentation":"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.","triggerScenarios":"Entering 0 or negative for 'Minimum Length of Undefined Range to Search' in the plugin options; programmatic set with a non-positive Long.","commonSituations":"User clearing the field or entering 0 thinking it disables the minimum; mis-typed value; scripted defaults pushed wrong.","solutions":["Set the option to a positive integer (default is 16); e.g. 16.","Validate > 0 in the UI before applying; the veto reverts invalid values automatically.","Programmatically, ensure the Long passed is >= 1."],"exampleFix":"// before\noptions.setLong(\"Minimum Length of Undefined Range to Search\", 0); // vetoed\n\n// after\noptions.setLong(\"Minimum Length of Undefined Range to Search\", 16L);","handlingStrategy":"validation","validationCode":"long v = options.getLong(\"Minimum Length of Undefined Range to Search\", 16L);\nif (v <= 0) v = 16L;\nif (newMin > 0) options.setLong(\"Minimum Length of Undefined Range to Search\", newMin);","typeGuard":"null","tryCatchPattern":"try {\n    options.setLong(\"Minimum Length of Undefined Range to Search\", value);\n} catch (OptionsVetoException e) {\n    // previous value retained; prompt for a positive integer\n}","preventionTips":["Pass a positive Long for the minimum undefined range size.","Validate > 0 in the editor before Apply.","Use the default (16) when unsure."],"tags":["machine-learning","options","validation","function-finder"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}