NationalSecurityAgency/ghidra · error · IllegalStateException

Breakpoint must be saved to a program before naming

Error message

Breakpoint must be saved to a program before naming

What it means

Thrown by LoneLogicalBreakpoint.setName because a 'lone' logical breakpoint has no backing program bookmark (it is not yet persisted/saved). Naming requires a saved breakpoint so the name can be stored on the program bookmark.

Source

Thrown at Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LoneLogicalBreakpoint.java:90

	@Override
	public Bookmark getProgramBookmark() {
		return null;
	}

	@Override
	public List<Bookmark> getProgramBookmarksValidOrNot() {
		return List.of();
	}

	@Override
	public String getName() {
		return "";
	}

	@Override
	public void setName(String name) {
		throw new IllegalStateException("Breakpoint must be saved to a program before naming");
	}

	@Override
	public String getEmuSleigh() {
		return breaks.computeSleigh();
	}

	@Override
	public void setEmuSleigh(String sleigh) {
		breaks.setEmuSleigh(sleigh);
	}

	@Override
	public void setTraceAddress(Trace trace, Address address) {
		throw new AssertionError();
	}

	@Override

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Save/persist the breakpoint to a program before renaming it.
  2. Check getProgramBookmarksValidOrNot().isEmpty() / whether the breakpoint is a LoneLogicalBreakpoint before calling setName.
  3. Use the trace/object API to set a display name for trace-only breakpoints instead of setName.
  4. Recreate the breakpoint via the normal breakpoint service so it is program-backed.

Example fix

// before
logicalBreakpoint.setName("mybp"); // throws if lone/unsaved

// after
if (logicalBreakpoint.getProgramBookmarksValidOrNot().isEmpty()) {
    Msg.warn(this, "Breakpoint not saved to a program; cannot name it");
} else {
    logicalBreakpoint.setName("mybp");
}
Defensive patterns

Strategy: validation

Validate before calling

boolean nameable = !logicalBreakpoint.getProgramBookmarksValidOrNot().isEmpty();

Type guard

static boolean isSaved(LogicalBreakpoint bp) {
    return !bp.getProgramBookmarksValidOrNot().isEmpty();
}

Try / catch

try {
    bp.setName(name);
} catch (IllegalStateException e) {
    Msg.showWarn(this, null, "Not saved", e.getMessage());
}

Prevention

When it happens

Trigger: Calling setName(name) on a LogicalBreakpoint instance that is a LoneLogicalBreakpoint (created without a program-scoped bookmark, e.g., a trace-only/emulated breakpoint).

Common situations: Attempting to rename an emulated or trace-only breakpoint that was never saved to a Program; operating on a breakpoint whose program was closed or never assigned.

Related errors


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