{"record":{"id":"9db8a483fcb3a306","repo":"NationalSecurityAgency/ghidra","slug":"function-list-cannot-be-empty","errorCode":null,"errorMessage":"Function list cannot be empty","messagePattern":"Function list cannot be empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/facade/SFOverviewInfo.java","lineNumber":45,"sourceCode":"\tpublic static final int DEFAULT_QUERIES_PER_STAGE  = 10;\t\t// Default number of separate function queries to make at one time\n\t\n\tprivate Set<FunctionSymbol> functions;\n\tprivate Program program;\n\tprivate QueryNearestVector queryNearestVector;\n\tprivate PreFilter preFilter;\n\t\n\t/**\n\t * Constructs an overview request with default parameters.\n\t * @param functions required--a set of functions (at least one) for which an overview will be \n\t * \t\t\t\t\tcomputed.  All functions must be from the same program.\n\t * @throws IllegalArgumentException if {@code functions} is {@code null}/empty or functions\n\t * are from multiple programs.  \n\t */\n\tpublic SFOverviewInfo(Set<FunctionSymbol> functions) {\n\t\tif (functions == null)\n\t\t\tthrow new IllegalArgumentException(\"Function list cannot be null\");\n\t\tif (functions.isEmpty())\n\t\t\tthrow new IllegalArgumentException(\"Function list cannot be empty\");\n\t\t\n\t\tthis.functions = functions;\n\t\tfor (FunctionSymbol s : functions) {\n\t\t\tif (program == null) {\n\t\t\t\tprogram = s.getProgram();\n\t\t\t}\n\t\t\telse if (program != s.getProgram()) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"all function symbols are not from the same program\");\n\t\t\t}\n\t\t}\n\t\tqueryNearestVector = new QueryNearestVector();\n\t\tpreFilter = new PreFilter();\n\t}\n\t\n\t/**\n\t * @return the program from which all queried functions are from\n\t */","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/facade/SFOverviewInfo.java#L27-L63","documentation":"Thrown by the SFOverviewInfo constructor when the Set<FunctionSymbol> functions is non-null but empty (isEmpty()). The overview requires at least one function to hash and query; an empty set would produce a meaningless request. It is the second ordered check after the null check.","triggerScenarios":"new SFOverviewInfo(Set.of()) or passing a set that was populated from a selection filter that matched nothing.","commonSituations":"User runs the overview action with nothing selected or with a filter that yields zero functions; programmatic batch loop whose current item resolved to no symbols.","solutions":["Guard the action entry point: if the selection set is empty, inform the user and skip construction.","When iterating, skip iterations that resolve to an empty set rather than constructing SFOverviewInfo.","Ensure selection providers return non-empty sets by filtering to functions-only at the UI layer."],"exampleFix":"// before\nSet<FunctionSymbol> syms = getSelectedFunctions();\nSFOverviewInfo info = new SFOverviewInfo(syms);\n// after\nSet<FunctionSymbol> syms = getSelectedFunctions();\nif (syms == null || syms.isEmpty()) { return; }\nSFOverviewInfo info = new SFOverviewInfo(syms);","handlingStrategy":"validation","validationCode":"if (functions == null || functions.isEmpty()) {\n    popup(\"Select at least one function first\");\n    return;\n}\nSFOverviewInfo info = new SFOverviewInfo(functions);","typeGuard":"static boolean nonEmptyFunctions(Set<FunctionSymbol> fns) {\n    return fns != null && !fns.isEmpty();\n}","tryCatchPattern":"try {\n    new SFOverviewInfo(functions);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"empty\")) { /* inform user */ }\n}","preventionTips":["Filter selections to function symbols and require >=1 before enabling the overview action.","In batch loops, skip items that resolve to empty sets.","Surface 'no functions selected' at the UI rather than at construction."],"tags":["bsim","facade","validation","argument-error","overview"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}