NationalSecurityAgency/ghidra · error · UnsupportedOperationException

Cannot use program view to set the trace name

Error message

Cannot use program view to set the trace name

What it means

Thrown as UnsupportedOperationException by setName on a DBTraceProgramView because the view is a read-oriented snapshot window into the trace and cannot rename the underlying trace. The trace's name is a domain-object property that must be set on the trace (or its DomainFile), not through the per-snap program view.

Source

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

	@Override
	public boolean removePrivateEventQueue(EventQueueID id) {
		return eventQueues.removePrivateEventQueue(id);
	}

	@Override
	public String getDescription() {
		return trace.getDescription() + " (at snap " + snap + ")";
	}

	@Override
	public String getName() {
		return trace.getName() + " (snap " + snap + ")";
	}

	@Override
	public void setName(String name) {
		throw new UnsupportedOperationException("Cannot use program view to set the trace name");
	}

	@Override
	public DomainFile getDomainFile() {
		return trace.getDomainFile();
	}

	@Override
	public boolean addConsumer(Object consumer) {
		return trace.addConsumer(consumer);
	}

	@Override
	public ArrayList<Object> getConsumerList() {
		return trace.getConsumerList();
	}

	@Override

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Set the name on the trace itself: trace.setName(name), or on the DomainFile.
  2. Detect DBTraceProgramView and route the rename to the underlying trace object.
  3. Avoid generic 'rename Program' helpers that call setName blindly; add a type check.

Example fix

// before
programView.setName("newName");

// after
if (programView instanceof DBTraceProgramView tpv) {
    tpv.getTrace().setName("newName");
} else {
    program.setName("newName");
}
Defensive patterns

Strategy: validation

Validate before calling

// Route setName to the trace, not the view
if (program instanceof DBTraceProgramView tpv) {
    tpv.getTrace().setName(name);
} else {
    program.setName(name);
}

Type guard

static boolean isTraceProgramView(Program p) {
    return p instanceof DBTraceProgramView;
}

Prevention

When it happens

Trigger: Calling programView.setName(name) on a DBTraceProgramView obtained from a trace.

Common situations: Running rename logic that calls setName on any Program without distinguishing trace views. UI/script code that assumes the Program handle is the canonical owner of the name.

Related errors


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