NationalSecurityAgency/ghidra · error · IllegalStateException

There is no trace

Error message

There is no trace

What it means

Thrown by FlatDebuggerAPI.requireTrace(trace) when the caller passes a null trace reference. This is a null-check guard for an explicitly supplied trace argument, distinct from requireCurrentTrace() which checks the active trace.

Source

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

	 */
	default Trace requireCurrentTrace() {
		Trace trace = getCurrentTrace();
		if (trace == null) {
			throw new IllegalStateException("There is no current trace");
		}
		return trace;
	}

	/**
	 * Require that the given trace is not null
	 * 
	 * @param trace the trace
	 * @return the trace
	 * @throws IllegalStateException if the trace is null
	 */
	default Trace requireTrace(Trace trace) {
		if (trace == null) {
			throw new IllegalStateException("There is no trace");
		}
		return trace;
	}

	/**
	 * Get the current trace platform
	 * 
	 * @return the trace platform, or null
	 */
	default TracePlatform getCurrentPlatform() {
		return getTraceManager().getCurrentPlatform();
	}

	/**
	 * Get the current trace platform, throwing an exception if there isn't one
	 * 
	 * @return the trace platform
	 * @throws IllegalStateException if there is no current trace platform

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Check the trace variable for null before passing it to requireTrace().
  2. Trace the source of the trace reference and handle the not-found case explicitly.
  3. Use getCurrentTrace() instead if you meant the active trace.

Example fix

// before
Trace t = findTraceById(id); // may return null
requireTrace(t); // throws

// after
Trace t = findTraceById(id);
if (t == null) {
    println("No trace for id " + id);
    return;
}
Defensive patterns

Strategy: validation

Validate before calling

if (trace == null) {
    println("Trace reference is null");
    return;
}

Type guard

static boolean isNonNullTrace(Trace t) {
    return t != null;
}

Try / catch

try {
    requireTrace(trace);
} catch (IllegalStateException e) {
    if (e.getMessage().equals("There is no trace")) {
        // fall back to getCurrentTrace()
        trace = getCurrentTrace();
    } else throw e;
}

Prevention

When it happens

Trigger: Calling requireTrace(someTrace) where someTrace is null, e.g., a variable holding the result of a lookup that returned null.

Common situations: Passing a trace obtained from a search/lookup that found nothing; chaining lookups where an intermediate result was null; logic errors that leave the trace variable unassigned.

Related errors


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