Transaction Failed (transaction_failed)
Quick Fix & Resolution
Inspect extras.result_codes.transaction and extras.result_codes.operations in the response and consult the Transaction Result Codes and Operation Result Codes reference.
Response Payload & SDK Handling
json
{
"type": "https://orion.stellarchain.io/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.",
"extras": {
"envelope_xdr": "AAAAAgAAAADdfhHDs4Vaug6p8Oxb1QRjNRdJt3pYKKBVhFHrEgd9QAAAAAoAEi4YAAAAAwAAAAE...",
"result_codes": {
"transaction": "tx_failed",
"operations": [
"op_underfunded"
]
},
"result_xdr": "AAAAAAAAAGT/////AAAAAQAAAAAAAAAB////+wAAAAA="
}
}typescript
import { Horizon } from '@stellar/stellar-sdk';
const server = new Horizon.Server('https://pubnet.stellarchain.io');
try {
const res = await server.ledgers().limit(10).call();
} catch (err: any) {
const problem = err?.response?.data;
if (problem?.type === 'https://orion.stellarchain.io/horizon-errors/transaction_failed') {
console.error('[transaction_failed] HTTP 400:', problem.detail, problem.extras);
}
}go
client := &horizonclient.Client{
HorizonURL: "https://pubnet.stellarchain.io",
}
_, err := client.Root()
if hErr := horizonclient.GetError(err); hErr != nil {
if hErr.Problem.Status == 400 {
log.Printf("Problem (%s): %s - extras=%v", hErr.Problem.Type, hErr.Problem.Detail, hErr.Problem.Extras)
}
}bash
curl -i -s "https://pubnet.stellarchain.io/" \
-H "Accept: application/hal+json"Common Root Causes
- Insufficient XLM or asset balance (
op_underfunded,tx_insufficient_balance). - Invalid sequence number (
tx_bad_seq). - Missing or invalid signatures (
tx_bad_auth,op_bad_auth). - Missing trustline on destination account (
op_no_trust). - Minimum fee not met (
tx_insufficient_fee).
XDR Result Codes Reference (extras.result_codes)
| Result Code Level | Documentation Link | Description |
|---|---|---|
Transaction (tx_*) | Transaction Result Codes | tx_failed, tx_bad_seq, tx_insufficient_balance, tx_insufficient_fee, tx_bad_auth |
Operation (op_*) | Operation Result Codes | op_underfunded, op_no_trust, op_bad_auth, op_line_full, op_low_reserve |
| Operation-Specific | 13 Operation Tables | Detailed per-operation failure matrices for Payments, Offers, Trustlines, and Account Merge |