{"record":{"id":"605b27d0d342fc90","repo":"NationalSecurityAgency/ghidra","slug":"offer-requires-image-but-no-program-given","errorCode":null,"errorMessage":"Offer requires image, but no program given.","messagePattern":"Offer requires image, but no program given\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.java","lineNumber":684,"sourceCode":"\t\t\tboolean mapped;\n\t\t\ttry {\n\t\t\t\tmapped = invokeMapper(monitor, mappingService, connection, trace, spec);\n\t\t\t}\n\t\t\tcatch (CancelledException ce) {\n\t\t\t\tthrow new CancellationException(e.getMessage());\n\t\t\t}\n\t\t\tif (!mapped) {\n\t\t\t\tthrow new NoStaticMappingException(\n\t\t\t\t\t\"The resulting target process has no mapping to the static image.\");\n\t\t\t}\n\t\t}\n\t\tmonitor.increment();\n\t}\n\n\t@Override\n\tpublic LaunchResult launchProgram(TaskMonitor monitor, LaunchConfigurator configurator) {\n\t\tif (requiresImage() && program == null) {\n\t\t\tthrow new IllegalStateException(\"Offer requires image, but no program given.\");\n\t\t}\n\t\tInternalTraceRmiService service = tool.getService(InternalTraceRmiService.class);\n\t\tDebuggerTraceManagerService traceManager =\n\t\t\ttool.getService(DebuggerTraceManagerService.class);\n\t\tfinal PromptMode mode = configurator.getPromptMode();\n\t\tboolean prompt = mode == PromptMode.ALWAYS;\n\n\t\tDefaultTraceRmiAcceptor acceptor = null;\n\t\tMap<String, TerminalSession> sessions = new LinkedHashMap<>();\n\t\tTraceRmiHandler connection = null;\n\t\tTrace trace = null;\n\t\tThrowable lastExc = null;\n\n\t\tupdateMonitorMax(monitor, null);\n\t\twhile (true) {\n\t\t\ttry {\n\t\t\t\tmonitor.setMessage(\"Gathering arguments\");\n\t\t\t\tMap<String, ValStr<?>> args = getLauncherArgs(prompt, configurator, lastExc);","sourceCodeStart":666,"sourceCodeEnd":702,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.java#L666-L702","documentation":"Thrown as IllegalStateException at the very start of launchProgram when the offer's requiresImage() returns true but the program field is null. Some launch offers (e.g., launching a local program under a debugger) intrinsically need a static program image to map against; calling them without one is a programmer/usage error, not a runtime condition.","triggerScenarios":"Invoking launchProgram on an offer that was constructed without a Program, or where the program reference was cleared/null. This typically happens when the launch is triggered from a context that has no active program, or the offer was created for a different purpose.","commonSituations":"Trying to launch a debugger from the global menu when no program is open; the active program was closed before the launch offer executed; a plugin/automation path created an offer without binding a Program.","solutions":["Open and activate the target program in Ghidra before invoking the launch offer.","If invoking programmatically, ensure the Program is passed to the offer at construction time.","Select an offer whose requiresImage() is false if you intend to launch without a static image."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (offer.requiresImage() && program == null) {\n    throw new IllegalStateException(\"Open a program before launching this offer\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always open and activate the target program before invoking an image-requiring offer.","When scripting launches, pass the Program to the offer constructor.","Check requiresImage() to choose the right offer type."],"tags":["launch","program-state","illegal-state","ghidra-debug"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}