NationalSecurityAgency/ghidra · error · RuntimeError

'ghidra_trace_connect': missing required argument 'address'

Error message

'ghidra_trace_connect': missing required argument 'address'

What it means

Raised as RuntimeError by ghidra_trace_connect() when the address argument is None. The command requires a 'host:port' string to dial Ghidra's trace RMI bridge; calling it with no argument (and no default) is rejected.

Source

Thrown at Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/commands.py:156

            raise RuntimeError("Transaction already started")

    def reset_tx(self) -> None:
        self.tx: Optional[Transaction] = None


STATE = State()


def ghidra_trace_connect(address: Optional[str] = None) -> None:
    """
    Connect Python to Ghidra for tracing

    Address must be of the form 'host:port'
    """

    STATE.require_no_client()
    if address is None:
        raise RuntimeError(
            "'ghidra_trace_connect': missing required argument 'address'")

    parts = address.split(':')
    if len(parts) != 2:
        raise RuntimeError("address must be in the form 'host:port'")
    host, port = parts
    try:
        c = socket.socket()
        c.connect((host, int(port)))
        # TODO: Can we get version info from the DLL?
        STATE.client = Client(c, "drgn", methods.REGISTRY)
        print(f"Connected to {STATE.client.description} at {address}")
    except ValueError:
        raise RuntimeError("port must be numeric")


def ghidra_trace_listen(address: str = '127.0.0.1:0') -> None:
    """

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Pass a non-None 'host:port' string to ghidra_trace_connect().
  2. Validate the address is not None and is a str before calling.
  3. In calling code, default address to the configured bridge endpoint rather than None.

Example fix

// before
ghidra_trace_connect()  # RuntimeError: missing required argument
// after
ghidra_trace_connect(os.getenv('GHIDRA_TRACE_ADDR', '127.0.0.1:12345'))
Defensive patterns

Strategy: validation

Validate before calling

if not isinstance(address, str) or not address:
    raise RuntimeError("'ghidra_trace_connect': address must be a 'host:port' string")
ghidra_trace_connect(address)

Type guard

def is_valid_address_arg(address) -> bool:
    return isinstance(address, str) and bool(address)

Try / catch

try:
    ghidra_trace_connect(address)
except RuntimeError as e:
    if 'missing required argument' in str(e):
        ghidra_trace_connect(os.getenv('GHIDRA_TRACE_ADDR', '127.0.0.1:12345'))
    else:
        raise

Prevention

When it happens

Trigger: Invoking ghidra_trace_connect() without an address, or with address explicitly None (e.g. a script that forgot to pass the port).

Common situations: Scripting the connect step without supplying host:port; UI/command binding that dropped the argument.

Related errors


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