NationalSecurityAgency/ghidra · error · LoadException
Selected file is not a program
Error message
Selected file is not a program
What it means
LoadException from TenetLoader after resolving the named domain file: it checks df.getContentType() against ProgramContentHandler.PROGRAM_CONTENT_TYPE and throws if they differ. The selected file must be a Ghidra Program; a Trace, data-type archive, folder, or other content type is rejected.
Source
Thrown at Ghidra/Debug/Debugger-importers/src/main/java/ghidra/app/util/opinion/TenetLoader.java:276
Trace trace;
String programPath = null;
for (final Option option : settings.options()) {
final String name = option.getName();
if (name.equals(DOMAIN_FILE_OPTION_NAME)) {
programPath = (String) option.getValue();
}
}
if ((programPath == null) || programPath.isBlank()) {
throw new LoadException("No progam to associate with trace was given");
}
Msg.info(this, "Loading trace for %s".formatted(programPath));
final DomainFile df = settings.project().getProjectData().getFile(programPath);
if (!df.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
throw new LoadException("Selected file is not a program");
}
Program program = null;
try {
program = (Program) df.getDomainObject(this, false, false, settings.monitor());
final long start = System.currentTimeMillis();
trace = loadTrace(settings.provider(), settings.importName(), program,
settings.consumer(), settings.log(), settings.monitor());
final long loadDone = System.currentTimeMillis();
// TODO: This is needed because
// ghidra.trace.database.DBTraceContentHandler.createFile can't do
// it, due to a lock in
// ghidra.framework.data.GhidraFolderData.createFile
final DBTraceObjectManager objManager = (DBTraceObjectManager) trace.getObjectManager();View on GitHub (pinned to d5f144c24d)
Solutions
- Point DOMAIN_FILE_OPTION_NAME at a domain file whose content type equals ProgramContentHandler.PROGRAM_CONTENT_TYPE.
- Before loading, resolve the DomainFile and assert its getContentType() is the Program content type, surfacing a clearer message to the user.
- Re-import or open the intended executable as a Program first, then reference that domain file path.
Example fix
// before
// (user picks an archive .gdt as the associated program)
// after
DomainFile df = project.getProjectData().getFile(programPath);
if (!ProgramContentHandler.PROGRAM_CONTENT_TYPE.equals(df.getContentType())) {
throw new IllegalArgumentException(programPath + " is not a Program; pick the executable");
} Defensive patterns
Strategy: validation
Validate before calling
DomainFile df = project.getProjectData().getFile(programPath);
if (df == null || !ProgramContentHandler.PROGRAM_CONTENT_TYPE.equals(df.getContentType())) {
throw new IllegalArgumentException(programPath + " is not a Program");
} Try / catch
try {
loader.load(settings);
} catch (LoadException e) {
if (e.getMessage().contains("not a program")) {
// re-prompt for a Program domain file
}
} Prevention
- Verify the domain file content type is Program before associating it with a trace.
- Do not point the loader at archives (.gdt), traces, or folders.
- In the GUI, filter the file picker to Program content.
When it happens
Trigger: DOMAIN_FILE_OPTION_NAME points at a domain file whose content type is not a Program (e.g. a previously imported Trace, a .gdt archive, a folder). Resolved via settings.project().getProjectData().getFile(programPath).
Common situations: User selects the trace's own file or an archive instead of the executable program in the import dialog; wrong path string that resolves to a non-program domain object; selecting a project folder rather than a leaf program file.
Related errors
- Selected file is not a program
- No progam to associate with trace was given
- No progam to associate with trace was given
- Cannot add Trace to a program
- Encountered too many errors with this trace
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/afc5fc4ff54ce353.
Report an issue: GitHub.