{"record":{"id":"68279a1e8955b4bd","repo":"NationalSecurityAgency/ghidra","slug":"selected-file-is-not-a-program-68279a","errorCode":null,"errorMessage":"Selected file is not a program","messagePattern":"Selected file is not a program","errorType":"exception","errorClass":"LoadException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-importers/src/main/java/ghidra/app/util/opinion/TenetPlusPlusLoader.java","lineNumber":307,"sourceCode":"\t\t\t\tprogramPath = (String) option.getValue();\n\t\t\t}\n\t\t\telse if (name.equals(STORE_REGS_AS_ATTRS_OPTION_NAME)) {\n\t\t\t\tstoreRegsAsAttrs = (boolean) option.getValue();\n\t\t\t}\n\t\t\telse if (name.equals(ADD_ALL_MEM_REFS_OPTION_NAME)) {\n\t\t\t\taddAllMemRefs = (boolean) option.getValue();\n\t\t\t}\n\t\t}\n\n\t\tif ((programPath == null) || programPath.isBlank()) {\n\t\t\tthrow new LoadException(\"No progam to associate with trace was given\");\n\t\t}\n\n\t\tMsg.info(this, \"Loading trace for %s\".formatted(programPath));\n\n\t\tfinal DomainFile df = settings.project().getProjectData().getFile(programPath);\n\t\tif (!df.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {\n\t\t\tthrow new LoadException(\"Selected file is not a program\");\n\t\t}\n\t\tProgram program = null;\n\n\t\ttry {\n\t\t\tprogram = (Program) df.getDomainObject(this, false, false, settings.monitor());\n\n\t\t\tfinal long start = System.currentTimeMillis();\n\n\t\t\ttrace = loadTrace(settings.provider(), settings.importName(), program,\n\t\t\t\tsettings.consumer(), settings.log(), settings.monitor());\n\n\t\t\tfinal long loadDone = System.currentTimeMillis();\n\n\t\t\t// TODO: This is needed because\n\t\t\t// ghidra.trace.database.DBTraceContentHandler.createFile can't do\n\t\t\t// it, due to a lock in\n\t\t\t// ghidra.framework.data.GhidraFolderData.createFile\n\t\t\tfinal DBTraceObjectManager objManager = (DBTraceObjectManager) trace.getObjectManager();","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-importers/src/main/java/ghidra/app/util/opinion/TenetPlusPlusLoader.java#L289-L325","documentation":"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.","triggerScenarios":"DOMAIN_FILE_OPTION_NAME resolves via getProjectData().getFile(programPath) to a non-Program domain file; getContentType() differs from the Program content type.","commonSituations":"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.","solutions":["Set DOMAIN_FILE_OPTION_NAME to a domain file whose content type is ProgramContentHandler.PROGRAM_CONTENT_TYPE.","Resolve the DomainFile first and validate its content type, returning a clearer error if it is not a Program.","Import/open the intended executable as a Program, then reference that path."],"exampleFix":"// before\n// (caller passes a Trace or .gdt path as the program)\n\n// after\nDomainFile df = project.getProjectData().getFile(programPath);\nif (!ProgramContentHandler.PROGRAM_CONTENT_TYPE.equals(df.getContentType())) {\n    throw new IllegalArgumentException(programPath + \" is not a Program\");\n}","handlingStrategy":"validation","validationCode":"DomainFile df = project.getProjectData().getFile(programPath);\nif (df == null || !ProgramContentHandler.PROGRAM_CONTENT_TYPE.equals(df.getContentType())) {\n    throw new IllegalArgumentException(programPath + \" is not a Program\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    loader.load(settings);\n} catch (LoadException e) {\n    if (e.getMessage().contains(\"not a program\")) {\n        // re-prompt for a Program domain file\n    }\n}","preventionTips":["Ensure the associated file's content type is Program.","Avoid selecting archives, traces, or folders as the program.","Filter the picker to Program content in the GUI."],"tags":["ghidra","import","loader","program","trace","tenet","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}