NationalSecurityAgency/ghidra · error · TraceRmiError

Must set id or path

Error message

Must set id or path

What it means

Thrown as TraceRmiError by OpenTrace.getObject(ObjSpec, boolean) when the protobuf ObjSpec message has KEY_NOT_SET — neither the id field nor the path field was populated by the remote client. Every object reference in the Trace RMI protocol must identify its target by id or by path; an empty spec is a client-side protocol violation.

Source

Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/OpenTrace.java:121

	public TraceObject getObject(ObjPath path, boolean required) {
		TraceObject object =
			trace.getObjectManager().getObjectByCanonicalPath(TraceRmiHandler.toKeyPath(path));
		if (required && object == null) {
			throw new InvalidObjPathError(path.getPath());
		}
		return object;
	}

	@Override
	public TraceObject getObject(ObjDesc desc, boolean required) {
		return getObject(desc.getId(), required);
	}

	@Override
	public TraceObject getObject(ObjSpec object, boolean required) {
		return switch (object.getKeyCase()) {
			case KEY_NOT_SET -> throw new TraceRmiError("Must set id or path");
			case ID -> getObject(object.getId(), required);
			case PATH -> getObject(object.getPath(), required);
			default -> throw new AssertionError();
		};
	}

	public AddressSpace getSpace(String name, boolean required) {
		AddressSpace space = trace.getBaseAddressFactory().getAddressSpace(name);
		if (required && space == null) {
			throw new NoSuchAddressSpaceError(name);
		}
		return space;
	}

	@Override
	public Address toAddress(Addr addr, boolean required) {
		/**
		 * Do not clamp here, like we do for ranges. The purpose of the given address is more

View on GitHub (pinned to d5f144c24d)

Solutions

  1. On the client/connector side, ensure every ObjSpec sets either .id or .path before sending.
  2. Upgrade the connector/agent to a version compatible with the Ghidra Trace RMI schema.
  3. If scripting, validate that the ObjSpec has one of the two keys set before issuing the command.

Example fix

// before (client side)
ObjSpec spec = ObjSpec.newBuilder().build(); // neither set -> server throws

// after
ObjSpec spec = ObjSpec.newBuilder().setId(123).build();
Defensive patterns

Strategy: validation

Validate before calling

// Client-side: ensure ObjSpec has id or path set before sending
ObjSpec spec = ...;
if (spec.getKeyCase() == ObjSpec.KeyCase.KEY_NOT_SET) {
    throw new IllegalArgumentException("ObjSpec must set id or path");
}

Type guard

boolean isObjSpecValid(ObjSpec s) {
    return s.getKeyCase() == ObjSpec.KeyCase.ID || s.getKeyCase() == ObjSpec.KeyCase.PATH;
}

Prevention

When it happens

Trigger: A remote Trace RMI client (a debugger agent/connector) sends a command carrying an ObjSpec but neglects to set either ObjSpec.id or ObjSpec.path before transmitting. The server-side OpenTrace switch hits the KEY_NOT_SET case and rejects it.

Common situations: A bug in the connector/agent that constructs object references; a protocol version mismatch where the client expects a field the server reads differently; an automation script building raw ObjSpec messages incorrectly; deserialization of a malformed message leaving both fields unset.

Related errors


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