{"record":{"id":"929b760d244b4de4","repo":"NationalSecurityAgency/ghidra","slug":"maximum-size-of-test-sets-must-be-positive","errorCode":null,"errorMessage":"Maximum size of test sets must be positive!","messagePattern":"Maximum size of test sets must be positive!","errorType":"validation","errorClass":"OptionsVetoException","httpStatus":null,"severity":"warning","filePath":"Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java","lineNumber":116,"sourceCode":"\n\t@Override\n\tprotected void dispose() {\n\t\tsuper.dispose();\n\n\t\tif (paramsDialog != null) {\n\t\t\tparamsDialog.dispose();\n\t\t}\n\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/**","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java#L98-L134","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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(...)."],"exampleFix":"// before\noptions.setLong(\"Maximum size of test sets\", 0); // vetoed\n\n// after\noptions.setLong(\"Maximum size of test sets\", 1_000_000L);","handlingStrategy":"validation","validationCode":"long v = options.getLong(\"Maximum size of test sets\", 1_000_000L);\nif (v <= 0) v = 1_000_000L; // clamp before any code reads it\n// when setting:\nif (newMax > 0) options.setLong(\"Maximum size of test sets\", newMax);","typeGuard":"null","tryCatchPattern":"try {\n    options.setLong(\"Maximum size of test sets\", value);\n} catch (OptionsVetoException e) {\n    // option kept its previous value; re-prompt with a positive integer\n}","preventionTips":["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."],"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"}