NationalSecurityAgency/ghidra · error · RuntimeError

Usage: ghidra util wait-stopped [SECONDS]

Error message

Usage: ghidra util wait-stopped [SECONDS]

What it means

Raised by ghidra_util_wait_stopped when more than one argument is supplied. The command spin-waits until the selected process/thread reports stopped, taking an optional SECONDS timeout (default 1); two or more tokens trip the usage RuntimeError at commands.py:2084.

Source

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

@convert_errors
def ghidra_util_wait_stopped(debugger: lldb.SBDebugger, command: str,
                             result: lldb.SBCommandReturnObject,
                             internal_dict: Dict[str, Any]) -> None:
    """Spin wait until the selected thread is stopped.

    Usage: ghidra util wait-stopped [SECONDS]

    An optional timeout may be given in seconds. If omitted, the timeout is 1
    second.
    """

    args = shlex.split(command)
    if len(args) == 0:
        timeout = 1
    elif len(args) == 1:
        timeout = int(args[0])
    else:
        raise RuntimeError("Usage: ghidra util wait-stopped [SECONDS]")

    start = time.time()
    p = util.get_process()
    while p is not None and p.state == lldb.eStateRunnig:
        time.sleep(0.1)
        p = util.get_process()  # I suppose it could change
        if time.time() - start > timeout:
            raise RuntimeError('Timed out waiting for thread to stop')
    print(f"Finished wait. State={p.state}")

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Pass zero or one integer second value: `ghidra util wait-stopped` or `ghidra util wait-stopped 5`.
  2. Do not include units; supply a bare integer (the code does int(args[0])).

Example fix

// before
ghidra util wait-stopped 5s
// after
ghidra util wait-stopped 5
Defensive patterns

Strategy: validation

Validate before calling

parts = command.split()
assert len(parts) <= 1, "wait-stopped takes 0 or 1 integer SECONDS"
if parts:
    int(parts[0])  # ensure it parses as int

Prevention

When it happens

Trigger: Calling `ghidra util wait-stopped 5 extra`, passing a unit suffix (`wait-stopped 5s` becomes one token but int() then fails differently), or two numeric tokens.

Common situations: Users append units or comments, or a script passes an already-split list. Note the same function has a separate typo bug (eStateRunnig) that affects the wait behavior, not this argument check.

Related errors


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