{"record":{"id":"207e8011d27849a8","repo":"NationalSecurityAgency/ghidra","slug":"usage-ghidra-trace-set-value-path-key-value-sche","errorCode":null,"errorMessage":"Usage: ghidra trace set-value PATH KEY VALUE [SCHEMA]","messagePattern":"Usage: ghidra trace set-value PATH KEY VALUE \\[SCHEMA\\]","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py","lineNumber":1235,"sourceCode":"    # humans.\n    # TODO: path and key are two separate parameters.... This is mostly to\n    # spare me from porting path parsing to Python, but it may also be useful\n    # if we ever allow ids here, since the id would be for the object, not the\n    # complete value path.\n\n    args = shlex.split(command)\n    if len(args) == 3:\n        path = args[0]\n        key = args[1]\n        value = args[2]\n        schema = None\n    elif len(args) == 4:\n        path = args[0]\n        key = args[1]\n        value = args[2]\n        schema = sch.Schema(args[3])\n    else:\n        raise RuntimeError(\n            \"Usage: ghidra trace set-value PATH KEY VALUE [SCHEMA]\")\n\n    trace, tx = STATE.require_tx()\n    if schema == sch.OBJECT:\n        val: Union[bool, int, float, bytes, Tuple[str, Address], List[bool],\n                   List[int], str, TraceObject, Address,\n                   None] = trace.proxy_object_path(value)\n    else:\n        val, schema = eval_value(value, schema)\n        if schema == sch.ADDRESS and isinstance(val, tuple):\n            base, addr = val\n            val = addr\n            if base != addr.space:\n                trace.create_overlay_space(base, addr.space)\n    trace.proxy_object_path(path).set_value(key, val, schema)\n\n\nretain_values_parser = optparse.OptionParser(prog='ghidra trace retain-values',","sourceCodeStart":1217,"sourceCodeEnd":1253,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py#L1217-L1253","documentation":"Usage error raised by ghidra_trace_set_value when the token count is not 3 or 4. The command requires PATH, KEY, VALUE, and optionally an explicit SCHEMA; the SCHEMA is parsed via sch.Schema(args[3]) and must be a valid schema name.","triggerScenarios":"Wrong token count; passing an invalid schema name (which throws inside sch.Schema before reaching this message); quoting issues that split PATH/KEY.","commonSituations":"User omits KEY or VALUE; user passes a flag; user supplies a SCHEMA string that is not a recognized schema enum.","solutions":["Pass exactly 3 tokens (PATH KEY VALUE) or 4 (PATH KEY VALUE SCHEMA).","Use a KEY of the form [INDEX] to denote an element, or a plain name for an attribute.","If supplying SCHEMA, confirm it is one of sch.Schema's valid names (e.g. BOOL, LONG, ADDRESS, STRING)."],"exampleFix":"// before\nghidra trace set-value Processes[0].Threads[1] pc\n// after\nghidra trace set-value Processes[0].Threads[1] pc $pc ADDRESS","handlingStrategy":"validation","validationCode":"import shlex\nfrom ghidralldb import schema as sch\n\ndef validate_set_value(command: str) -> None:\n    toks = shlex.split(command)\n    if len(toks) not in (3, 4):\n        raise ValueError('set-value needs PATH KEY VALUE [SCHEMA]')\n    if len(toks) == 4:\n        sch.Schema(toks[3])  # raises early on invalid schema name","typeGuard":"def key_is_element(key: str) -> bool:\n    return key.startswith('[') and key.endswith(']')","tryCatchPattern":"try:\n    ghidra_trace_set_value(debugger, command, result, internal_dict)\nexcept (RuntimeError, ValueError) as e:\n    result.SetError(str(e))","preventionTips":["Pass PATH KEY VALUE, optionally SCHEMA.","Use [INDEX] for elements, plain names for attributes.","Validate SCHEMA against sch.Schema before invoking."],"tags":["ghidra-trace","argument-validation","set-value","cli-usage"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}