NationalSecurityAgency/ghidra · error · LoadException

Selected file is not a program

Error message

Selected file is not a program

What it means

LoadException from TenetPlusPlusLoader after resolving the named domain file: df.getContentType() must equal ProgramContentHandler.PROGRAM_CONTENT_TYPE, otherwise it throws. The associated file must be a Ghidra Program, not a Trace/archive/folder.

Source

Thrown at Ghidra/Debug/Debugger-importers/src/main/java/ghidra/app/util/opinion/TenetPlusPlusLoader.java:307

				programPath = (String) option.getValue();
			}
			else if (name.equals(STORE_REGS_AS_ATTRS_OPTION_NAME)) {
				storeRegsAsAttrs = (boolean) option.getValue();
			}
			else if (name.equals(ADD_ALL_MEM_REFS_OPTION_NAME)) {
				addAllMemRefs = (boolean) 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

  1. Set DOMAIN_FILE_OPTION_NAME to a domain file whose content type is ProgramContentHandler.PROGRAM_CONTENT_TYPE.
  2. Resolve the DomainFile first and validate its content type, returning a clearer error if it is not a Program.
  3. Import/open the intended executable as a Program, then reference that path.

Example fix

// before
// (caller passes a Trace or .gdt path as the program)

// after
DomainFile df = project.getProjectData().getFile(programPath);
if (!ProgramContentHandler.PROGRAM_CONTENT_TYPE.equals(df.getContentType())) {
    throw new IllegalArgumentException(programPath + " is not a Program");
}
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

When it happens

Trigger: DOMAIN_FILE_OPTION_NAME resolves via getProjectData().getFile(programPath) to a non-Program domain file; getContentType() differs from the Program content type.

Common situations: Selecting a .gdt data-type archive, an existing Trace, or a project folder as the associated program; stale path referencing a file that was re-imported as a different content type.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/68279a1e8955b4bd. Report an issue: GitHub.