NationalSecurityAgency/ghidra · error · IllegalArgumentException

Platform is not in this trace

Error message

Platform is not in this trace

What it means

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.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceVariableSnapProgramView.java:58

	@Override
	public void setSnap(long newSnap) {
		if (this.snap == newSnap) {
			return;
		}
		//long oldSnap = this.snap;
		this.snap = newSnap;
		viewport.setSnap(newSnap);
		memory.setSnap(newSnap);

		// TODO: I could be more particular, but this seems to work fast enough, now.
		fireObjectRestored();
	}

	@Override
	public void setPlatform(TracePlatform platform) {
		if (!(platform instanceof InternalTracePlatform iPlatform) ||
			platform.getTrace() != trace) {
			throw new IllegalArgumentException("Platform is not in this trace");
		}
		this.platform = iPlatform;
	}
}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Obtain the platform from the same trace backing the view: view.setPlatform(trace.getPlatform(langID)).
  2. Before calling, assert platform.getTrace() == view.getTrace() to fail early with your own message.
  3. If you need a guest platform, ensure it was registered via trace.getPlatformManager().addPlatform(...) on this trace first.

Example fix

// before
view.setPlatform(otherTrace.getPlatform(langID));
// after
view.setPlatform(view.getTrace().getPlatform(langID));
Defensive patterns

Strategy: validation

Validate before calling

// before setPlatform
TracePlatform p = ...;
if (!(p instanceof InternalTracePlatform) || p.getTrace() != view.getTrace()) {
    throw new IllegalArgumentException("platform not from this trace");
}
view.setPlatform(p);

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/030264923948ef13. Report an issue: GitHub.