NationalSecurityAgency/ghidra · error · IllegalStateException
TraceObject requires a trace for context
Error message
TraceObject requires a trace for context
What it means
Thrown by the default ValueDecoder.getObject(ObjSpec, boolean) when required is true. An ObjSpec resolves to a TraceObject, which requires the trace's object manager (context). The default decoder has no trace, so it cannot look up an object by id/path and throws.
Source
Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/ValueDecoder.java:93
};
default Address toAddress(Addr addr, boolean required) {
if (required) {
throw new IllegalStateException("Address requires a trace for context");
}
return null;
}
default AddressRange toRange(AddrRange range, boolean required) {
if (required) {
throw new IllegalStateException("AddressRange requires a trace for context");
}
return null;
}
default Object getObject(ObjSpec spec, boolean required) {
if (required) {
throw new IllegalStateException("TraceObject requires a trace for context");
}
return null;
}
default Object getObject(ObjDesc desc, boolean required) {
if (required) {
throw new IllegalStateException("TraceObject requires a trace for context");
}
return null;
}
default Object toValue(Value value) {
return switch (value.getValueCase()) {
case NULL_VALUE -> null;
case BOOL_VALUE -> value.getBoolValue();
case BYTE_VALUE -> (byte) value.getByteValue();
case CHAR_VALUE -> (char) value.getCharValue();
case SHORT_VALUE -> (short) value.getShortValue();View on GitHub (pinned to d5f144c24d)
Solutions
- Use the OpenTrace decoder to resolve ObjSpecs against the trace's object tree.
- Call getObject(spec, false) if the object is optional, to get null rather than an exception.
- For display-only purposes, use ValueDecoder.DISPLAY which renders a placeholder string instead of resolving.
Example fix
// before Object o = ValueDecoder.DEFAULT.getObject(spec, true); // after Object o = openTrace.getObject(spec, true);
Defensive patterns
Strategy: validation
Validate before calling
ValueDecoder dec = (openTrace != null) ? openTrace : ValueDecoder.DEFAULT; Object o = (openTrace != null) ? dec.getObject(spec, true) : null;
Type guard
boolean hasTraceContext(ValueDecoder dec) {
return dec instanceof OpenTrace;
} Try / catch
try {
return dec.getObject(spec, true);
} catch (IllegalStateException e) {
return null;
} Prevention
- Resolve ObjSpec values through the OpenTrace decoder.
- Pass required=false when the object is optional.
- Use ValueDecoder.DISPLAY for human-readable placeholders without trace context.
When it happens
Trigger: Calling getObject(spec, true) on ValueDecoder.DEFAULT while decoding a value that is an object specification, with no OpenTrace available.
Common situations: Decoding a method argument default that references an object without a bound trace; message decoding in a context that omitted the trace.
Related errors
- Address requires a trace for context
- AddressRange requires a trace for context
- Processes[{proc.GetProcessID()}].Threads[{tnum}] does not ex
- Breakpoints[{breaknum}] does not exist
- Watchpoints[{watchnum}] does not exist
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/518719d829bb8d58.
Report an issue: GitHub.