NationalSecurityAgency/ghidra · error · RuntimeError
Usage: ghidra trace disconnect
Error message
Usage: ghidra trace disconnect
What it means
`ghidra trace disconnect` takes no arguments; it closes the client stored in STATE. Any extra token aborts before the close runs (so the client is left connected).
Source
Thrown at Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py:356
print(f"Connection from {chost}:{cport}")
STATE.client = Client(
c, util.LLDB_VERSION.display, methods.REGISTRY)
except ValueError:
raise RuntimeError("PORT must be numeric")
@convert_errors
def ghidra_trace_disconnect(debugger: lldb.SBDebugger, command: str,
result: lldb.SBCommandReturnObject,
internal_dict: Dict[str, Any]) -> None:
"""Disconnect LLDB from Ghidra for tracing.
Usage: ghidra trace disconnect
"""
args = shlex.split(command)
if len(args) != 0:
raise RuntimeError("Usage: ghidra trace disconnect")
STATE.require_client().close()
STATE.reset_client()
def compute_name() -> str:
target = lldb.debugger.GetTargetAtIndex(0)
progname = target.executable.basename
if progname is None:
return 'lldb/noname'
else:
return 'lldb/' + progname.split('/')[-1]
def start_trace(name: str) -> None:
language, compiler = arch.compute_ghidra_lcsp()
STATE.trace = STATE.require_client().create_trace(
name, language, compiler, extra=Extra())View on GitHub (pinned to d5f144c24d)
Solutions
- Call it with no arguments: `ghidra trace disconnect`
Example fix
// before ghidra trace disconnect 127.0.0.1:12345 // after ghidra trace disconnect
Defensive patterns
Strategy: validation
Validate before calling
import shlex
def no_args(command: str) -> bool:
return len(shlex.split(command)) == 0 Try / catch
try:
ghidra_trace_disconnect(debugger, command, result, internal_dict)
except RuntimeError as e:
if str(e).startswith('Usage: ghidra trace disconnect'):
# drop all arguments and retry
...
raise Prevention
- Disconnect takes no arguments — it uses the stored client
- Run `ghidra trace info` to confirm a connection exists before disconnecting
When it happens
Trigger: `ghidra trace disconnect now`; `ghidra trace disconnect 127.0.0.1:12345`.
Common situations: Assuming disconnect needs the address (it does not — it uses STATE.client); adding a confirmation word.
Related errors
- Usage: ghidra trace connect ADDRESS
- ADDRESS must be HOST:PORT
- port must be numeric
- ADDRESS must be PORT or HOST:PORT
- Usage: ghidra trace listen [ADDRESS]
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/7597ec1caf3c25af.
Report an issue: GitHub.