# Find your agent's reverted transactions

> Search Jaeger for the traces where an agent's transaction reverted, filter by agent, and read the decoded revert reason on the confirm span.

Source: https://hashspan.dev/docs/recipes/find-reverted-transactions

Your agent ran for a day. Which of its transactions reverted, and why? Each confirm span hashspan records carries the outcome as `blockchain.tx.status`, so a reverted transaction is one attribute search away.

## Search by status

In the Jaeger UI, pick the agent's service and type this into **Attributes**:

```text
blockchain.tx.status=reverted
```

Every trace in the results has at least one reverted transaction. Open one: the `confirm` span with the error mark is the reverted one, under the tool call that sent it.

## Narrow it to one agent

Several agents in one service? Add the agent's name, separated by a space:

```text wrap
blockchain.tx.status=reverted gen_ai.agent.name=treasury-agent
```

hashspan puts `gen_ai.agent.name` on its spans from the tracker's `agent` option or from Baggage ([agent identity](https://hashspan.dev/docs/reference/semantic-conventions#attributes)).

## Read why it reverted

The reverted confirm span records, in this example from the local lab:

- `blockchain.tx.status`: `reverted`
- `error.type`: `reverted`
- `blockchain.tx.revert.reason`: `WithdrawalLimitExceeded(100000000000000000, 1000000000000000000)`

The revert reason is decoded by replaying the transaction, so custom errors show their name and arguments when the ABI is known ([how](https://hashspan.dev/docs/reference/attributes/transactions#blockchaintxrevertreason)).

## The same search over the API

Jaeger's API takes the attributes as a JSON object. This returns the traces from the last hour:

```sh
curl -sG http://localhost:16686/api/v3/traces \
  --data-urlencode 'query.service_name=treasury-agent' \
  --data-urlencode "query.start_time_min=$(date -u -v-1H +%Y-%m-%dT%H:%M:%SZ)" \
  --data-urlencode "query.start_time_max=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
  --data-urlencode 'query.attributes={"blockchain.tx.status":"reverted"}'
```

The `date -v` flag is macOS's; on Linux use `date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%SZ`.

## Other values worth a search

- `blockchain.tx.status=replaced`: the agent's transaction was replaced by another with the same nonce; `blockchain.tx.replacement.hash` names the one that was mined.
- `error.type=timeout`: the wait gave up before a receipt came. No `blockchain.tx.status` is recorded then, since the outcome on chain is not known.

Every attribute is listed in the [attribute reference](https://hashspan.dev/docs/reference/attributes/transactions).
