{"record":{"id":"b8c897e3e5a07da8","repo":"NationalSecurityAgency/ghidra","slug":"usage-ghidra-trace-tx-open-description-command","errorCode":null,"errorMessage":"Usage: ghidra trace tx-open DESCRIPTION COMMAND","messagePattern":"Usage: ghidra trace tx-open DESCRIPTION COMMAND","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py","lineNumber":591,"sourceCode":"    STATE.reset_tx()\n\n\n@convert_errors\ndef ghidra_trace_txopen(debugger: lldb.SBDebugger, command: str,\n                        result: lldb.SBCommandReturnObject,\n                        internal_dict: Dict[str, Any]) -> None:\n    \"\"\"Run a command with an open transaction.\n\n    Usage: ghidra trace tx-open DESCRIPTION COMMAND\n\n    Execute the given command with an open transaction. This is generally\n    useful only when executing a single 'put' command, or when executing a\n    custom command that performs several puts.\n    \"\"\"\n\n    args = shlex.split(command)\n    if len(args) != 2:\n        raise RuntimeError(\"Usage: ghidra trace tx-open DESCRIPTION COMMAND\")\n\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:","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py#L573-L609","documentation":"`ghidra trace tx-open` requires exactly two tokens: a DESCRIPTION and a COMMAND to run inside an open transaction. It is the recommended wrapper around one or more `put` commands. Fewer or more than two tokens aborts.","triggerScenarios":"Only one token (description omitted); three or more tokens because the COMMAND or DESCRIPTION contained spaces and was not quoted; e.g. `ghidra trace tx-open putmem 0x1000 0x10` (the COMMAND was not quoted so it splits).","commonSituations":"Passing a multi-word subcommand without quotes; omitting the description.","solutions":["Pass exactly two tokens, quoting any that contain spaces: `ghidra trace tx-open \"put memory\" \"ghidra trace putmem 0x1000 0x10\"`","Keep the COMMAND to a single subcommand, or wrap a multi-step put sequence in one quoted string"],"exampleFix":"// before\nghidra trace tx-open putmem 0x1000 0x10\n// after\nghidra trace tx-open \"put mem\" \"ghidra trace putmem 0x1000 0x10\"","handlingStrategy":"validation","validationCode":"import shlex\ndef exactly_two_args(command: str) -> bool:\n    return len(shlex.split(command)) == 2","typeGuard":null,"tryCatchPattern":"try:\n    ghidra_trace_txopen(debugger, command, result, internal_dict)\nexcept RuntimeError as e:\n    if str(e).startswith('Usage: ghidra trace tx-open'):\n        # quote the description and/or the embedded command and retry\n        ...\n    raise","preventionTips":["Quote both DESCRIPTION and COMMAND whenever either contains spaces","Prefer tx-open over manual tx-start/commit for single put commands","Keep the embedded COMMAND to one subcommand to avoid quoting pitfalls"],"tags":["ghidra","lldb","cli","validation","transaction"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}