NationalSecurityAgency/ghidra · error · RuntimeError
Not connected
Error message
Not connected
What it means
Thrown by State.require_client() when the client (connection to the Ghidra trace server) is None — no active connection exists. The dbgeng agent must connect to a Ghidra trace connector before issuing any commands that communicate with Ghidra. This RuntimeError is the guard for all commands requiring an active trace-bridge connection.
Source
Thrown at Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py:121
def require_mm(self) -> arch.DefaultMemoryMapper:
if self.memory_mapper is None:
raise RuntimeError("No memory mapper")
return self.memory_mapper
def require_rm(self) -> arch.DefaultRegisterMapper:
if self.register_mapper is None:
raise RuntimeError("No register mapper")
return self.register_mapper
class State(object):
def __init__(self) -> None:
self.reset_client()
def require_client(self) -> Client:
if self.client is None:
raise RuntimeError("Not connected")
return self.client
def require_no_client(self) -> None:
if self.client != None:
raise RuntimeError("Already connected")
def reset_client(self) -> None:
self.client: Optional[Client] = None
self.reset_trace()
def require_trace(self) -> Trace[Extra]:
if self.trace is None:
raise RuntimeError("No trace active")
return self.trace
def require_no_trace(self) -> None:
if self.trace != None:
raise RuntimeError("Trace already started")View on GitHub (pinned to d5f144c24d)
Solutions
- Call ghidra_trace_connect(address) with the correct host:port before any trace commands.
- Verify the Ghidra trace connector plugin is running and listening on the expected port.
- Check for a dropped connection — reconnect if network issues occurred.
- Ensure scripts call connect before any other trace operations.
Example fix
# Before: issuing commands without connecting
# ghidra_trace_putmem(...)
#
# After: connect first
# ghidra_trace_connect('127.0.0.1:12345')
# ghidra_trace_putmem(...) Defensive patterns
Strategy: validation
Validate before calling
# Before commands requiring a client, check connection state:
if STATE.client is not None:
# proceed with command
else:
ghidra_trace_connect('127.0.0.1:12345') Type guard
def is_connected(state) -> bool:
return state.client is not None Try / catch
try:
client = STATE.require_client()
except RuntimeError as e:
if str(e) == 'Not connected':
ghidra_trace_connect(address)
client = STATE.require_client()
else:
raise Prevention
- Always call ghidra_trace_connect before any trace-related commands.
- Verify the Ghidra trace connector plugin is active and listening.
- In scripts, connect at the start and disconnect at the end.
- Handle dropped connections with reconnect logic.
When it happens
Trigger: STATE.require_client() is called by any command needing the trace connector, but STATE.client is None (from reset_client or initial state). Happens when commands like ghidra_trace_putmem, ghidra_trace_start are issued before ghidra_trace_connect has been called.
Common situations: The user forgot to call ghidra_trace_connect('host:port') before issuing trace commands. The connection was dropped or reset and not re-established. The script execution order doesn't connect first.
Related errors
- Already connected
- No memory mapper
- No register mapper
- No trace active
- Address {address} is not in process {proc}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/da849535b95fe5e1.
Report an issue: GitHub.