NationalSecurityAgency/ghidra · error · IllegalArgumentException
Trace is not opened in this tool
Error message
Trace is not opened in this tool
What it means
DebuggerPlatformServicePlugin.getNewMapper() requires the trace to be open in the current tool before it can query platform opinions and create a mapper. It checks traceManager.getOpenTraces().contains(trace) and throws IllegalArgumentException("Trace is not opened in this tool") if not. A platform mapper needs the tool context (offers take(tool, trace)) to be constructed.
Source
Thrown at Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/platform/DebuggerPlatformServicePlugin.java:97
synchronized (mappersByTrace) {
mapper = mappersByTrace.get(trace);
if (mapper != null && mapper.canInterpret(object, snap)) {
return mapper;
}
mapper = getNewMapper(trace, object, snap);
if (mapper == null) {
return null;
}
mappersByTrace.put(trace, mapper);
}
firePluginEvent(new DebuggerPlatformPluginEvent(getName(), trace, mapper));
return mapper;
}
@Override
public DebuggerPlatformMapper getNewMapper(Trace trace, TraceObject object, long snap) {
if (!traceManager.getOpenTraces().contains(trace)) {
throw new IllegalArgumentException("Trace is not opened in this tool");
}
for (DebuggerPlatformOffer offer : DebuggerPlatformOpinion.queryOpinions(trace, object,
snap, false)) {
return offer.take(tool, trace);
}
return null;
}
@Override
public void setCurrentMapperFor(Trace trace, TraceObject focus, DebuggerPlatformMapper mapper, long snap) {
Objects.requireNonNull(trace);
Objects.requireNonNull(mapper);
if (!traceManager.getOpenTraces().contains(trace)) {
throw new IllegalArgumentException("Trace is not opened in this tool");
}
synchronized (mappersByTrace) {
mappersByTrace.put(trace, mapper);
}View on GitHub (pinned to d5f144c24d)
Solutions
- Open the trace in the trace manager (traceManager.openTrace(trace)) before calling getNewMapper.
- Guard with traceManager.getOpenTraces().contains(trace) and open if missing.
- Ensure you are operating within the same tool that owns the open trace.
Example fix
// before
DebuggerPlatformMapper mapper = platformService.getNewMapper(trace, obj, snap); // throws
// after
if (!traceManager.getOpenTraces().contains(trace)) {
traceManager.openTrace(trace);
}
DebuggerPlatformMapper mapper = platformService.getNewMapper(trace, obj, snap); Defensive patterns
Strategy: validation
Validate before calling
public static void ensureOpen(DebuggerTraceManagerService tm, Trace trace) {
if (!tm.getOpenTraces().contains(trace)) {
tm.openTrace(trace);
}
}
// before:
ensureOpen(traceManager, trace);
platformService.getNewMapper(trace, obj, snap); Type guard
public static boolean isOpenInTool(DebuggerTraceManagerService tm, Trace trace) {
return trace != null && tm.getOpenTraces().contains(trace);
} Try / catch
try {
platformService.getNewMapper(trace, obj, snap);
} catch (IllegalArgumentException e) {
if (e.getMessage().equals("Trace is not opened in this tool")) {
traceManager.openTrace(trace);
platformService.getNewMapper(trace, obj, snap);
} else throw e;
} Prevention
- Open the trace in the trace manager before any platform/mapping/emulation API.
- Drop trace references after close; re-open before reuse.
- Operate within the same tool that owns the open trace.
When it happens
Trigger: Calling getNewMapper(trace, object, snap) on a trace that was never opened or was closed. Obtaining a Trace from a domain file and requesting a platform mapper without opening it in the trace manager.
Common situations: Scripts or headless code that hold a Trace reference but never opened it in the tool. Reusing a Trace after the user closed it. Cross-tool calls where the trace is open in a different tool.
Related errors
- Cannot emulate a trace unless it's opened in the tool.
- Trace must be opened before activated: {}
- Emulation requires a Sleigh language
- Static program is not opened
- Given platform has been deleted
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/9279cc4a5b3b2b84.
Report an issue: GitHub.