NationalSecurityAgency/ghidra · error · RuntimeError

Usage: ghidra trace save

Error message

Usage: ghidra trace save

What it means

`ghidra trace save` persists the current trace through the connected Ghidra instance and takes no arguments — the destination is the live connection, not a local filename. Any extra token aborts before the save.

Source

Thrown at Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py:610

    description = args[0]
    cmd = args[1]
    with open_tracked_tx(description):
        lldb.debugger.GetCommandInterpreter().HandleCommand(cmd, result)


@convert_errors
def ghidra_trace_save(debugger: lldb.SBDebugger, command: str,
                      result: lldb.SBCommandReturnObject,
                      internal_dict: Dict[str, Any]) -> None:
    """Save the current trace.

    Usage: ghidra trace save
    """

    args = shlex.split(command)
    if len(args) != 0:
        raise RuntimeError("Usage: ghidra trace save")

    STATE.require_trace().save()


@convert_errors
def ghidra_trace_new_snap(debugger: lldb.SBDebugger, command: str,
                          result: lldb.SBCommandReturnObject,
                          internal_dict: Dict[str, Any]) -> None:
    """Create a new snapshot.

    Usage: ghidra trace new-snap [SNAP] DESCRIPTION

    Subsequent modifications to machine state will affect the new snapshot.
    """

    args = shlex.split(command)
    if len(args) == 1:
        time = None

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Call it with no arguments: `ghidra trace save` (the trace is saved via the active Ghidra connection)

Example fix

// before
ghidra trace save out.gdb
// after
ghidra trace save
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_save(debugger, command, result, internal_dict)
except RuntimeError as e:
    if str(e).startswith('Usage: ghidra trace save'):
        # drop arguments and retry
        ...
    raise

Prevention

When it happens

Trigger: `ghidra trace save out.gdb`; `ghidra trace save now`.

Common situations: Expecting a local output filename argument.

Related errors


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