# Transaction Failed

The `transaction_failed` error returns a [`400` error code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400) and occurs when a client submits a transaction that was well-formed but was not included in the ledger due to some other failure.

For example, a transaction may fail if:&#x20;

1. The source account for a transaction cannot pay the minimum fee.&#x20;
2. The sequence number is incorrect.&#x20;
3. One of the contained operations has failed, such as a payment operation that overdraws on the paying account.

In almost every case, this error indicates that the transaction submitted in the initial request will never succeed. There is one exception: a transaction that fails with the `tx_bad_seq` result code (as expressed in the `result_code` field of the error) may become valid in the future if the sequence number it used was too high.

```bash
{
  "type": "https://expansion-testnet.bantu.network/horizon-errors/transaction_failed",
  "title": "Transaction Failed",
  "status": 400,
  "detail": "The transaction failed when submitted to the stellar network. The `extras.result_codes` field on this response contains further details.  Descriptions of each code can be found at: https://www.stellar.org/developers/guides/concepts/list-of-operations.html",
  "extras": {
    "envelope_xdr": "AAAAAgAAAADdfhHDs4Vaug6p8Oxb1QRjNRdJt3pYKKBVhFHrEgd9QAAAAAoAEi4YAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAESB31AAAAAQFhc/liVXbLk3NtB2BtweFJ064JdDIfrTSrqKMhb1oIRK+0PSyvjzZTkRCJmQY3bHNXYNuepa2TF7aBdibrb1gI=",
    "result_codes": {
      "transaction": "tx_insufficient_fee"
    },
    "result_xdr": "AAAAAAAAAAr////3AAAAAA=="
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.docs.bantufoundation.org/api/errors/http-status-codes/horizon-specific/transaction-failed.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
