{"record":{"id":"1d4f71a96f05375b","repo":"NationalSecurityAgency/ghidra","slug":"usage-ghidra-util-wait-stopped-seconds","errorCode":null,"errorMessage":"Usage: ghidra util wait-stopped [SECONDS]","messagePattern":"Usage: ghidra util wait-stopped \\[SECONDS\\]","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py","lineNumber":2084,"sourceCode":"@convert_errors\ndef ghidra_util_wait_stopped(debugger: lldb.SBDebugger, command: str,\n                             result: lldb.SBCommandReturnObject,\n                             internal_dict: Dict[str, Any]) -> None:\n    \"\"\"Spin wait until the selected thread is stopped.\n\n    Usage: ghidra util wait-stopped [SECONDS]\n\n    An optional timeout may be given in seconds. If omitted, the timeout is 1\n    second.\n    \"\"\"\n\n    args = shlex.split(command)\n    if len(args) == 0:\n        timeout = 1\n    elif len(args) == 1:\n        timeout = int(args[0])\n    else:\n        raise RuntimeError(\"Usage: ghidra util wait-stopped [SECONDS]\")\n\n    start = time.time()\n    p = util.get_process()\n    while p is not None and p.state == lldb.eStateRunnig:\n        time.sleep(0.1)\n        p = util.get_process()  # I suppose it could change\n        if time.time() - start > timeout:\n            raise RuntimeError('Timed out waiting for thread to stop')\n    print(f\"Finished wait. State={p.state}\")\n","sourceCodeStart":2066,"sourceCodeEnd":2094,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/commands.py#L2066-L2094","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass zero or one integer second value: `ghidra util wait-stopped` or `ghidra util wait-stopped 5`.","Do not include units; supply a bare integer (the code does int(args[0]))."],"exampleFix":"// before\nghidra util wait-stopped 5s\n// after\nghidra util wait-stopped 5","handlingStrategy":"validation","validationCode":"parts = command.split()\nassert len(parts) <= 1, \"wait-stopped takes 0 or 1 integer SECONDS\"\nif parts:\n    int(parts[0])  # ensure it parses as int","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass a bare integer of seconds; never include units.","Use zero args for the default 1s timeout."],"tags":["lldb","ghidra","cli-usage","debugger-agent","wait"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}