{"record":{"id":"030264923948ef13","repo":"NationalSecurityAgency/ghidra","slug":"platform-is-not-in-this-trace","errorCode":null,"errorMessage":"Platform is not in this trace","messagePattern":"Platform is not in this trace","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceVariableSnapProgramView.java","lineNumber":58,"sourceCode":"\t@Override\n\tpublic void setSnap(long newSnap) {\n\t\tif (this.snap == newSnap) {\n\t\t\treturn;\n\t\t}\n\t\t//long oldSnap = this.snap;\n\t\tthis.snap = newSnap;\n\t\tviewport.setSnap(newSnap);\n\t\tmemory.setSnap(newSnap);\n\n\t\t// TODO: I could be more particular, but this seems to work fast enough, now.\n\t\tfireObjectRestored();\n\t}\n\n\t@Override\n\tpublic void setPlatform(TracePlatform platform) {\n\t\tif (!(platform instanceof InternalTracePlatform iPlatform) ||\n\t\t\tplatform.getTrace() != trace) {\n\t\t\tthrow new IllegalArgumentException(\"Platform is not in this trace\");\n\t\t}\n\t\tthis.platform = iPlatform;\n\t}\n}\n","sourceCodeStart":40,"sourceCodeEnd":63,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceVariableSnapProgramView.java#L40-L63","documentation":"Thrown by DBTraceVariableSnapProgramView.setPlatform(TracePlatform) when the supplied platform does not belong to this trace. The guard requires the object to be an InternalTracePlatform (the DB-backed implementation) AND that platform.getTrace() == this view's trace. A platform from a different trace, or a non-DB platform implementation, fails both checks. This prevents a program view from displaying data under a language/compiler-spec set that was never registered with the trace.","triggerScenarios":"Calling view.setPlatform(platform) where platform was obtained from traceB.getPlatform(...) while view was created from traceA. Also passing a custom TracePlatform implementation that is not an InternalTracePlatform, or a platform whose getTrace() returns null/another trace.","commonSituations":"Multi-trace debugger sessions where the user copies a platform reference across traces. Plugins that cache a TracePlatform field and reuse it after the active trace changed. Cross-language emulation where a guest platform object is mistakenly applied to a host-only trace.","solutions":["Obtain the platform from the same trace backing the view: view.setPlatform(trace.getPlatform(langID)).","Before calling, assert platform.getTrace() == view.getTrace() to fail early with your own message.","If you need a guest platform, ensure it was registered via trace.getPlatformManager().addPlatform(...) on this trace first."],"exampleFix":"// before\nview.setPlatform(otherTrace.getPlatform(langID));\n// after\nview.setPlatform(view.getTrace().getPlatform(langID));","handlingStrategy":"validation","validationCode":"// before setPlatform\nTracePlatform p = ...;\nif (!(p instanceof InternalTracePlatform) || p.getTrace() != view.getTrace()) {\n    throw new IllegalArgumentException(\"platform not from this trace\");\n}\nview.setPlatform(p);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always derive the platform from the same trace that owns the view.","Never cache a TracePlatform across trace switches.","Register guest platforms on the target trace before use."],"tags":["trace","platform","program-view","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}