NationalSecurityAgency/ghidra · error · IllegalArgumentException
all function symbols are not from the same program
Error message
all function symbols are not from the same program
What it means
Thrown by the SFOverviewInfo constructor when iterating the function set reveals symbols sourced from more than one Program. The overview query must target one program (one signature context, one address space); the constructor captures the first symbol's program and rejects any symbol whose getProgram() differs. It is the third ordered check.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/facade/SFOverviewInfo.java:53
* Constructs an overview request with default parameters.
* @param functions required--a set of functions (at least one) for which an overview will be
* computed. All functions must be from the same program.
* @throws IllegalArgumentException if {@code functions} is {@code null}/empty or functions
* are from multiple programs.
*/
public SFOverviewInfo(Set<FunctionSymbol> functions) {
if (functions == null)
throw new IllegalArgumentException("Function list cannot be null");
if (functions.isEmpty())
throw new IllegalArgumentException("Function list cannot be empty");
this.functions = functions;
for (FunctionSymbol s : functions) {
if (program == null) {
program = s.getProgram();
}
else if (program != s.getProgram()) {
throw new IllegalArgumentException(
"all function symbols are not from the same program");
}
}
queryNearestVector = new QueryNearestVector();
preFilter = new PreFilter();
}
/**
* @return the program from which all queried functions are from
*/
public Program getProgram() {
return program;
}
public double getSimilarityThreshold() {
return queryNearestVector.thresh;
}
View on GitHub (pinned to d5f144c24d)
Solutions
- Filter the set to a single Program before construction (e.g. partition by getProgram() and issue one overview per program).
- At the UI layer, scope selection gathering to the active program only.
- If you genuinely need cross-program similarity, run separate SFOverviewInfo/SFQueryInfo instances per program.
Example fix
// before
Set<FunctionSymbol> all = collectFromMultiplePrograms();
SFOverviewInfo info = new SFOverviewInfo(all);
// after
Map<Program, Set<FunctionSymbol>> byProgram = all.stream()
.collect(Collectors.groupingBy(FunctionSymbol::getProgram, Collectors.toSet()));
for (Set<FunctionSymbol> per : byProgram.values()) {
SFOverviewInfo info = new SFOverviewInfo(per);
} Defensive patterns
Strategy: validation
Validate before calling
// partition by program first
Map<Program, Set<FunctionSymbol>> byProgram = functions.stream()
.collect(Collectors.groupingBy(FunctionSymbol::getProgram, Collectors.toSet()));
for (Set<FunctionSymbol> per : byProgram.values()) {
SFOverviewInfo info = new SFOverviewInfo(per);
} Type guard
static boolean singleProgram(Set<FunctionSymbol> fns) {
long programs = fns.stream().map(FunctionSymbol::getProgram).distinct().count();
return programs <= 1;
} Try / catch
try {
new SFOverviewInfo(functions);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("same program")) { /* split and retry per program */ }
} Prevention
- Scope selection gathering to the active program.
- Partition cross-program sets before constructing any query info.
- Drop external/library symbols whose Program differs from the target.
When it happens
Trigger: Passing a Set<FunctionSymbol> assembled from two open programs, or from a program plus a linked external/library program whose symbols leaked into the set.
Common situations: A multi-program selection in the listing; cross-program symbol sets built by a script that iterates several Program objects; stale set reused across program switches.
Related errors
- Function list cannot be null
- Function list cannot be empty
- all function symbols are not from the same program
- Function list cannot be null
- Function list cannot be empty
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/ba8666897043c71b.
Report an issue: GitHub.