NationalSecurityAgency/ghidra · error · IllegalStateException
There is no current trace view
Error message
There is no current trace view
What it means
Thrown by FlatDebuggerAPI.requireCurrentView() when there is no current trace program view. The view is an adapter that lets a trace be used as a Program for a chosen snapshot; it requires a current trace.
Source
Thrown at Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java:306
* give the "destination" scratch snapshot. See {@link #getCurrentEmulationSchedule()}.
*
* @see #getCurrentDebuggerCoordinates()
* @return the view
*/
default TraceProgramView getCurrentView() {
return getTraceManager().getCurrentView();
}
/**
* Get the current trace view, throwing an exception if there isn't one
*
* @return the trace view
* @throws IllegalStateException if there is no current trace view
*/
default TraceProgramView requireCurrentView() {
TraceProgramView view = getCurrentView();
if (view == null) {
throw new IllegalStateException("There is no current trace view");
}
return view;
}
/**
* Get the current frame, 0 being the innermost
*
* <p>
* If the target doesn't support frames, this will return 0
*
* @see #getCurrentDebuggerCoordinates()
* @return the frame
*/
default int getCurrentFrame() {
return getTraceManager().getCurrentFrame();
}
/**View on GitHub (pinned to d5f144c24d)
Solutions
- Ensure a trace is current before calling view-dependent methods.
- Guard with getCurrentView() != null.
- Use getCurrentTrace()/requireCurrentTrace() first, which implies a view can be obtained.
Example fix
// before
TraceProgramView v = requireCurrentView(); // throws if none
// after
if (getCurrentTrace() == null) {
println("No active trace");
return;
}
TraceProgramView v = requireCurrentView(); Defensive patterns
Strategy: type-guard
Validate before calling
TraceProgramView v = getCurrentView();
if (v == null) {
println("No current trace view; open a trace first");
return;
} Type guard
static boolean hasCurrentView(FlatDebuggerAPI api) {
return api.getCurrentView() != null;
} Try / catch
try {
TraceProgramView v = requireCurrentView();
} catch (IllegalStateException e) {
if (e.getMessage().equals("There is no current trace view")) {
// ensure a trace is open, then retry
} else throw e;
} Prevention
- Ensure a trace is current before view-dependent operations.
- Use getCurrentView() != null as a precondition check.
When it happens
Trigger: Calling requireCurrentView() when getCurrentView() returns null, which occurs when no trace is current or the view has not been created.
Common situations: No active trace; the trace manager has not yet built a view for the current snapshot; operations that iterate a trace as a Program called before a trace is open.
Related errors
- There is no current program
- The given program is dynamic, i.e., a trace view
- Tool does not have service {cls}! This script should be run
- There is no current trace
- There is no trace
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/e0026827a80fdd66.
Report an issue: GitHub.