NationalSecurityAgency/ghidra · error · NoSuchElementException

No saved offers to launch {}

Error message

No saved offers to launch {}

What it means

NoSuchElementException thrown by FlatDebuggerRmiAPI.requireLastLaunchOffer(program). It asks the TraceRmi launcher service for previously-saved launch offers via getSavedLaunchOffers(program); if that list is empty it means no launch configuration has ever been saved for this program, so there is no 'last offer' to retrieve. The message interpolates the program (which may be null, printing 'null'). It is a programmatic guard, not a runtime/IO fault.

Source

Thrown at Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerRmiAPI.java:87

	 * Get saved offers for launching the current program, ordered by most-recently-saved
	 * 
	 * @return the offers
	 */
	default List<TraceRmiLaunchOffer> getSavedLaunchOffers() {
		return getSavedLaunchOffers(getCurrentProgram());
	}

	/**
	 * Get the most-recently-saved launch offer for the given program
	 * 
	 * @param program the program, or null for no image
	 * @return the offer
	 * @throws NoSuchElementException if no offer's configuration has been saved
	 */
	default TraceRmiLaunchOffer requireLastLaunchOffer(Program program) {
		List<TraceRmiLaunchOffer> offers = getSavedLaunchOffers(program);
		if (offers.isEmpty()) {
			throw new NoSuchElementException("No saved offers to launch " + program);
		}
		return offers.get(0);
	}

	/**
	 * Get the most-recently-saved launch offer for the current program
	 * 
	 * @return the offer
	 * @throws NoSuchElementException if no offer's configuration has been saved
	 */
	default TraceRmiLaunchOffer requireLastLaunchOffer() {
		return requireLastLaunchOffer(getCurrentProgram());
	}

	/**
	 * Launch the given offer with the default, saved, and/or overridden arguments
	 * 
	 * <p>

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Use getSavedLaunchOffers(program) and branch on isEmpty() instead of requireLastLaunchOffer(); enumerate/launch an offer or open the launcher configuration dialog to save one.
  2. Ensure a launch offer has been saved first: launch the target once interactively in the Debugger GUI, configure Image/Args, and save the configuration before running the script.
  3. Catch NoSuchElementException around the call and report a clear 'no saved launch configuration' message to the operator.
  4. If using the no-arg overload, confirm getCurrentProgram() returns the intended program (non-null) first.

Example fix

// before
TraceRmiLaunchOffer offer = flatApi.requireLastLaunchOffer();

// after
List<TraceRmiLaunchOffer> offers = flatApi.getSavedLaunchOffers();
if (offers.isEmpty()) {
    throw new IllegalStateException("No saved launch configuration; launch and save one first");
}
TraceRmiLaunchOffer offer = offers.get(0);
Defensive patterns

Strategy: validation

Validate before calling

List<TraceRmiLaunchOffer> offers = flatApi.getSavedLaunchOffers(program);
if (offers.isEmpty()) {
    // configure/launch an offer or prompt the user to save one
    return;
}
TraceRmiLaunchOffer offer = offers.get(0);

Try / catch

try {
    TraceRmiLaunchOffer offer = flatApi.requireLastLaunchOffer(program);
} catch (NoSuchElementException e) {
    // no saved launch configuration for this program; handle gracefully
}

Prevention

When it happens

Trigger: Calling requireLastLaunchOffer(program) or the no-arg requireLastLaunchOffer() (which passes getCurrentProgram()) before any TraceRmiLaunchOffer configuration has been saved for that program. Happens in headless/scripts that jump straight to requireLastLaunchOffer() without first launching and saving arguments through the TraceRmi launcher service.

Common situations: First-time scripted debugging where the user has not yet launched the target once in the GUI and saved the image/args; scripts run against a freshly imported program that has no saved offers; calling the no-arg overload before a current program is active (program is null).

Related errors


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