NationalSecurityAgency/ghidra · error · TraceRmiError
Cannot receive TraceRmi message with excessive message lengt
Error message
Cannot receive TraceRmi message with excessive message length
What it means
Intended to be raised as TraceRmiError by recv_delimited() when the length-prefix advertises a message size greater than MAX_MSG_LENGTH (1<<16 = 64 KiB), a sanity check against malicious/corrupt framing. IMPORTANT BUG: util.py raises 'TraceRmiError' but never imports or defines it, so if this line executes it throws NameError: name 'TraceRmiError' is not defined rather than the intended error.
Source
Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/py/src/ghidratrace/util.py:60
part = s.recv(size - len(buf))
if len(part) == 0:
return buf
buf += part
return buf
# return s.recv(size, socket.MSG_WAITALL)
def recv_length(s: socket.socket) -> int:
buf = recv_all(s, 4)
if len(buf) < 4:
raise Exception("Socket closed")
return int.from_bytes(buf, 'big')
def recv_delimited(s: socket.socket, msg: M, dbg_seq: int) -> M:
size = recv_length(s)
if size > MAX_MSG_LENGTH:
raise TraceRmiError("Cannot receive TraceRmi message with excessive message length")
buf = recv_all(s, size)
if len(buf) < size:
raise Exception("Socket closed")
msg.ParseFromString(buf)
return msg
View on GitHub (pinned to d5f144c24d)
Solutions
- Confirm both ends speak the same TraceRmi protocol/version.
- Ensure you are connecting to a TraceRmi endpoint and not an unrelated service.
- If developing, fix the latent bug by importing/defining TraceRmiError so this guard is actually usable.
Example fix
// not a runtime fix per se — verify endpoint and version # before: client pointed at wrong port/service # after: connect to the Ghidra TraceRmi listening port and matching version
Defensive patterns
Strategy: validation
Validate before calling
from ghidratrace.util import MAX_MSG_LENGTH
if size > MAX_MSG_LENGTH:
raise ValueError(f'announced size {size} exceeds {MAX_MSG_LENGTH}; framing/endpoint mismatch') Try / catch
try:
msg = recv_delimited(s, proto, seq)
except (ValueError, NameError):
# wrong endpoint or corrupt framing; reset connection
raise Prevention
- Connect only to genuine TraceRmi endpoints.
- Match client/server protocol versions.
- Fix the latent TraceRmiError import bug if you maintain util.py.
When it happens
Trigger: A corrupted/garbled length prefix decodes to a huge value; a peer using a different framing convention; memory corruption on the socket buffer; rarely a genuinely oversized message that bypassed the send-side guard due to the bug in 395.
Common situations: Protocol/version mismatch producing mis-framed bytes; noisy/unreliable link; debugging against a non-TraceRmi endpoint on the same port.
Related errors
- Cannot send TraceRmi message with excessive length
- Cannot send TraceRmi message with excessive length
- Cannot receive TraceRmi message with excessive message lengt
- Could not receive negotiation request
- Could not respond during negotiation
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/9dba8ebb4a58a813.
Report an issue: GitHub.