{"record":{"id":"332c5f8baa8c71be","repo":"NationalSecurityAgency/ghidra","slug":"no-trace-active-332c5f","errorCode":null,"errorMessage":"No trace active","messagePattern":"No trace active","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/commands.py","lineNumber":118,"sourceCode":"    def __init__(self) -> None:\n        self.reset_client()\n\n    def require_client(self) -> Client:\n        if self.client is None:\n            raise RuntimeError(\"Not connected\")\n        return self.client\n\n    def require_no_client(self) -> None:\n        if self.client != None:\n            raise RuntimeError(\"Already connected\")\n\n    def reset_client(self) -> None:\n        self.client: Optional[Client] = None\n        self.reset_trace()\n\n    def require_trace(self) -> Trace[Extra]:\n        if self.trace is None:\n            raise RuntimeError(\"No trace active\")\n        return self.trace\n\n    def require_no_trace(self) -> None:\n        if self.trace != None:\n            raise RuntimeError(\"Trace already started\")\n\n    def reset_trace(self) -> None:\n        self.trace: Optional[Trace[Extra]] = None\n        util.set_convenience_variable('_ghidra_tracing', \"false\")\n        self.reset_tx()\n\n    def require_tx(self) -> Tuple[Trace, Transaction]:\n        trace = self.require_trace()\n        if self.tx is None:\n            raise RuntimeError(\"No transaction\")\n        return trace, self.tx\n\n    def require_no_tx(self) -> None:","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/commands.py#L100-L136","documentation":"Raised as RuntimeError by State.require_trace() when STATE.trace is None — no Trace has been created yet. Trace-touching commands require a prior successful ghidra_trace_start().","triggerScenarios":"Invoking put/activate/save commands (or any trace op) before ghidra_trace_start(); after ghidra_trace_stop() reset the trace.","commonSituations":"Skipping the start step in a script; start_trace() failed (e.g. schema load error) leaving trace None; operating after stop without restart.","solutions":["Run ghidra_trace_start(name) and confirm trace creation before trace commands.","Guard: if STATE.trace is None: report 'start trace first'.","After ghidra_trace_stop(), call ghidra_trace_restart()/start before further trace ops."],"exampleFix":"// before\ntrace = STATE.require_trace()  # RuntimeError: No trace active\n// after\nif STATE.trace is None:\n    ghidra_trace_start()\ntrace = STATE.require_trace()","handlingStrategy":"validation","validationCode":"if STATE.trace is None:\n    raise RuntimeError('call ghidra_trace_start first')\ntrace = STATE.require_trace()","typeGuard":"def has_trace() -> bool:\n    return getattr(STATE, 'trace', None) is not None","tryCatchPattern":"try:\n    trace = STATE.require_trace()\nexcept RuntimeError as e:\n    if 'No trace active' in str(e):\n        ghidra_trace_start(); trace = STATE.require_trace()\n    else:\n        raise","preventionTips":["Run ghidra_trace_start() before any trace-touching command.","After ghidra_trace_stop(), start/restart before further trace ops.","Confirm start_trace() succeeded (schema loaded) before proceeding."],"tags":["drgn","trace","state-machine","precondition"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}