NationalSecurityAgency/ghidra · error · RuntimeError

No trace active

Error message

No trace active

What it means

Raised by State.require_trace when STATE.trace is None. The trace object is created by start_trace (via 'ghidra trace start') and holds the connection to Ghidra's trace-rpc along with memory and register mappers. Any trace-data operation (put-*, activate, etc.) that calls require_trace before start_trace will hit this guard.

Source

Thrown at Ghidra/Debug/Debugger-agent-x64dbg/src/main/py/src/ghidraxdbg/commands.py:131

    def __init__(self) -> None:
        self.reset_client()

    def require_client(self) -> Client:
        if self.client is None:
            raise RuntimeError("Not connected")
        return self.client

    def require_no_client(self) -> None:
        if self.client != None:
            raise RuntimeError("Already connected")

    def reset_client(self) -> None:
        self.client: Optional[Client] = None
        self.reset_trace()

    def require_trace(self) -> Trace[Extra]:
        if self.trace is None:
            raise RuntimeError("No trace active")
        return self.trace

    def require_no_trace(self) -> None:
        if self.trace != None:
            raise RuntimeError("Trace already started")

    def reset_trace(self) -> None:
        self.trace: Optional[Trace[Extra]] = None
        util.set_convenience_variable('_ghidra_tracing', "false")
        self.reset_tx()

    def require_tx(self) -> Tuple[Trace, Transaction]:
        trace = self.require_trace()
        if self.tx is None:
            raise RuntimeError("No transaction")
        return trace, self.tx

    def require_no_tx(self) -> None:

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Run 'ghidra trace start' successfully before issuing any trace-data commands.
  2. Verify start_trace completed without errors (check schema.xml path and language detection).
  3. After a disconnect/reconnect cycle, re-run 'ghidra trace start' before data commands.

Example fix

# before: data command without trace
trace = STATE.require_trace()  # trace is None

# after: start trace lifecycle first
ghidra_trace_connect('127.0.0.1:12345')
ghidra_trace_start()
trace = STATE.require_trace()
Defensive patterns

Strategy: validation

Validate before calling

if STATE.trace is None:
    raise RuntimeError("No trace active; run 'ghidra trace start' first")

Type guard

def has_trace() -> bool:
    return STATE.trace is not None

Try / catch

try:
    trace = STATE.require_trace()
except RuntimeError:
    ghidra_trace_connect('127.0.0.1:12345')
    ghidra_trace_start()
    trace = STATE.require_trace()

Prevention

When it happens

Trigger: A command calls STATE.require_trace() before 'ghidra trace start' has created the trace, or after reset_trace cleared it. This happens when data commands are issued before the trace lifecycle is initiated.

Common situations: User issued 'ghidra trace put-*' or activate commands before 'ghidra trace start'. The trace was reset (e.g. after disconnect) and not re-started. start_trace failed (e.g. missing schema.xml, or language detection failed) leaving trace as None.

Related errors


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