{"record":{"id":"331f2c5efbeba652","repo":"NationalSecurityAgency/ghidra","slug":"usage-ghidra-trace-save","errorCode":null,"errorMessage":"Usage: ghidra trace save","messagePattern":"Usage: ghidra trace save","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py","lineNumber":610,"sourceCode":"\n    description = args[0]\n    cmd = args[1]\n    with open_tracked_tx(description):\n        lldb.debugger.GetCommandInterpreter().HandleCommand(cmd, result)\n\n\n@convert_errors\ndef ghidra_trace_save(debugger: lldb.SBDebugger, command: str,\n                      result: lldb.SBCommandReturnObject,\n                      internal_dict: Dict[str, Any]) -> None:\n    \"\"\"Save the current trace.\n\n    Usage: ghidra trace save\n    \"\"\"\n\n    args = shlex.split(command)\n    if len(args) != 0:\n        raise RuntimeError(\"Usage: ghidra trace save\")\n\n    STATE.require_trace().save()\n\n\n@convert_errors\ndef ghidra_trace_new_snap(debugger: lldb.SBDebugger, command: str,\n                          result: lldb.SBCommandReturnObject,\n                          internal_dict: Dict[str, Any]) -> None:\n    \"\"\"Create a new snapshot.\n\n    Usage: ghidra trace new-snap [SNAP] DESCRIPTION\n\n    Subsequent modifications to machine state will affect the new snapshot.\n    \"\"\"\n\n    args = shlex.split(command)\n    if len(args) == 1:\n        time = None","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py#L592-L628","documentation":"`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.","triggerScenarios":"`ghidra trace save out.gdb`; `ghidra trace save now`.","commonSituations":"Expecting a local output filename argument.","solutions":["Call it with no arguments: `ghidra trace save` (the trace is saved via the active Ghidra connection)"],"exampleFix":"// before\nghidra trace save out.gdb\n// after\nghidra trace save","handlingStrategy":"validation","validationCode":"import shlex\ndef no_args(command: str) -> bool:\n    return len(shlex.split(command)) == 0","typeGuard":null,"tryCatchPattern":"try:\n    ghidra_trace_save(debugger, command, result, internal_dict)\nexcept RuntimeError as e:\n    if str(e).startswith('Usage: ghidra trace save'):\n        # drop arguments and retry\n        ...\n    raise","preventionTips":["save takes no filename; it persists via the active Ghidra connection","Confirm a trace is active with `ghidra trace info` before saving"],"tags":["ghidra","lldb","cli","validation","trace"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}