{"record":{"id":"518719d829bb8d58","repo":"NationalSecurityAgency/ghidra","slug":"traceobject-requires-a-trace-for-context","errorCode":null,"errorMessage":"TraceObject requires a trace for context","messagePattern":"TraceObject requires a trace for context","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/ValueDecoder.java","lineNumber":93,"sourceCode":"\t};\n\n\tdefault Address toAddress(Addr addr, boolean required) {\n\t\tif (required) {\n\t\t\tthrow new IllegalStateException(\"Address requires a trace for context\");\n\t\t}\n\t\treturn null;\n\t}\n\n\tdefault AddressRange toRange(AddrRange range, boolean required) {\n\t\tif (required) {\n\t\t\tthrow new IllegalStateException(\"AddressRange requires a trace for context\");\n\t\t}\n\t\treturn null;\n\t}\n\n\tdefault Object getObject(ObjSpec spec, boolean required) {\n\t\tif (required) {\n\t\t\tthrow new IllegalStateException(\"TraceObject requires a trace for context\");\n\t\t}\n\t\treturn null;\n\t}\n\n\tdefault Object getObject(ObjDesc desc, boolean required) {\n\t\tif (required) {\n\t\t\tthrow new IllegalStateException(\"TraceObject requires a trace for context\");\n\t\t}\n\t\treturn null;\n\t}\n\n\tdefault Object toValue(Value value) {\n\t\treturn switch (value.getValueCase()) {\n\t\t\tcase NULL_VALUE -> null;\n\t\t\tcase BOOL_VALUE -> value.getBoolValue();\n\t\t\tcase BYTE_VALUE -> (byte) value.getByteValue();\n\t\t\tcase CHAR_VALUE -> (char) value.getCharValue();\n\t\t\tcase SHORT_VALUE -> (short) value.getShortValue();","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/ValueDecoder.java#L75-L111","documentation":"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.","triggerScenarios":"Calling getObject(spec, true) on ValueDecoder.DEFAULT while decoding a value that is an object specification, with no OpenTrace available.","commonSituations":"Decoding a method argument default that references an object without a bound trace; message decoding in a context that omitted the trace.","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."],"exampleFix":"// before\nObject o = ValueDecoder.DEFAULT.getObject(spec, true);\n\n// after\nObject o = openTrace.getObject(spec, true);","handlingStrategy":"validation","validationCode":"ValueDecoder dec = (openTrace != null) ? openTrace : ValueDecoder.DEFAULT;\nObject o = (openTrace != null) ? dec.getObject(spec, true) : null;","typeGuard":"boolean hasTraceContext(ValueDecoder dec) {\n    return dec instanceof OpenTrace;\n}","tryCatchPattern":"try {\n    return dec.getObject(spec, true);\n} catch (IllegalStateException e) {\n    return null;\n}","preventionTips":["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."],"tags":["value-decoder","trace-object","trace-context","trace-rmi"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}