NationalSecurityAgency/ghidra · error · RuntimeError
Usage: ghidra trace put-environment
Error message
Usage: ghidra trace put-environment
What it means
Raised by ghidra_trace_put_environment when any argument is passed. put-environment writes environment indicators (Debugger='lldb', Arch) for the current process into the trace and accepts no arguments (commands.py:1689).
Source
Thrown at Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py:1689
envobj.set_value('Debugger', 'lldb')
envobj.set_value('Arch', arch.get_arch())
envobj.set_value('OS', arch.get_osabi())
envobj.set_value('Endian', arch.get_endian())
envobj.insert()
@convert_errors
def ghidra_trace_put_environment(debugger: lldb.SBDebugger, command: str,
result: lldb.SBCommandReturnObject,
internal_dict: Dict[str, Any]) -> None:
"""Put some environment indicators into the Ghidra trace.
Usage: ghidra trace put-environment
"""
args = shlex.split(command)
if len(args) != 0:
raise RuntimeError("Usage: ghidra trace put-environment")
trace, tx = STATE.require_tx()
with trace.client.batch() as b:
put_environment()
def should_query_regions() -> bool:
"""It's possible some targets don't support regions.
There is also a bug in LLDB that can cause its gdb-remote client to
drop support. We need to account for this second case while still
ensuring we populate the full range for targets that genuinely don't
support it.
"""
# somewhat crappy heuristic to distinguish remote from local
tgt = util.get_target()
if tgt.GetNumModules() == 0:
# Target genuinely doesn't support regions.View on GitHub (pinned to d5f144c24d)
Solutions
- Run with no arguments: `ghidra trace put-environment`.
- To change arch, set the LLDB target's architecture (target triple) before launching so arch.get_arch() reports correctly.
Example fix
// before ghidra trace put-environment arm64 // after ghidra trace put-environment
Defensive patterns
Strategy: validation
Validate before calling
assert len(command.split()) == 0, "put-environment takes no arguments"
Prevention
- Arch is derived from the LLDB target triple, not an argument.
- Set the target architecture before launch if arch is wrong.
When it happens
Trigger: Adding an architecture or platform token like `ghidra trace put-environment x86_64`, or trailing text after the command.
Common situations: Users try to force an architecture via this command, but arch is derived from arch.get_arch(); passing it as an argument is rejected.
Related errors
- Usage: ghidra trace disassemble ADDRESS
- Usage: ghidra trace put-processes
- Usage: ghidra trace put-available
- Usage: ghidra trace put-breakpoints
- Usage: ghidra trace put-watchpoints
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/5c0684b03bb490b8.
Report an issue: GitHub.