{"record":{"id":"c75e9467acd0f69d","repo":"NationalSecurityAgency/ghidra","slug":"ghidra-trace-connect-missing-required-argument-c75e94","errorCode":null,"errorMessage":"'ghidra_trace_connect': missing required argument 'address'","messagePattern":"'ghidra_trace_connect': missing required argument 'address'","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/commands.py","lineNumber":156,"sourceCode":"            raise RuntimeError(\"Transaction already started\")\n\n    def reset_tx(self) -> None:\n        self.tx: Optional[Transaction] = None\n\n\nSTATE = State()\n\n\ndef ghidra_trace_connect(address: Optional[str] = None) -> None:\n    \"\"\"\n    Connect Python to Ghidra for tracing\n\n    Address must be of the form 'host:port'\n    \"\"\"\n\n    STATE.require_no_client()\n    if address is None:\n        raise RuntimeError(\n            \"'ghidra_trace_connect': missing required argument 'address'\")\n\n    parts = address.split(':')\n    if len(parts) != 2:\n        raise RuntimeError(\"address must be in the form 'host:port'\")\n    host, port = parts\n    try:\n        c = socket.socket()\n        c.connect((host, int(port)))\n        # TODO: Can we get version info from the DLL?\n        STATE.client = Client(c, \"drgn\", methods.REGISTRY)\n        print(f\"Connected to {STATE.client.description} at {address}\")\n    except ValueError:\n        raise RuntimeError(\"port must be numeric\")\n\n\ndef ghidra_trace_listen(address: str = '127.0.0.1:0') -> None:\n    \"\"\"","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/commands.py#L138-L174","documentation":"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.","triggerScenarios":"Invoking ghidra_trace_connect() without an address, or with address explicitly None (e.g. a script that forgot to pass the port).","commonSituations":"Scripting the connect step without supplying host:port; UI/command binding that dropped the argument.","solutions":["Pass a non-None 'host:port' string to ghidra_trace_connect().","Validate the address is not None and is a str before calling.","In calling code, default address to the configured bridge endpoint rather than None."],"exampleFix":"// before\nghidra_trace_connect()  # RuntimeError: missing required argument\n// after\nghidra_trace_connect(os.getenv('GHIDRA_TRACE_ADDR', '127.0.0.1:12345'))","handlingStrategy":"validation","validationCode":"if not isinstance(address, str) or not address:\n    raise RuntimeError(\"'ghidra_trace_connect': address must be a 'host:port' string\")\nghidra_trace_connect(address)","typeGuard":"def is_valid_address_arg(address) -> bool:\n    return isinstance(address, str) and bool(address)","tryCatchPattern":"try:\n    ghidra_trace_connect(address)\nexcept RuntimeError as e:\n    if 'missing required argument' in str(e):\n        ghidra_trace_connect(os.getenv('GHIDRA_TRACE_ADDR', '127.0.0.1:12345'))\n    else:\n        raise","preventionTips":["Always pass a non-None 'host:port' string to ghidra_trace_connect().","Default the address from an env var / config rather than leaving it None.","Validate the argument at the call site before invoking connect."],"tags":["drgn","connection","validation","argument"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}