Skip to content

Transaction Malformed (transaction_malformed) ​

HTTP 400Horizon RFC 7807 ProblemCode: transaction_malformed
Type URI: https://orion.stellarchain.io/horizon-errors/transaction_malformed

The `tx` parameter could not be decoded as a valid base64-encoded Stellar `TransactionEnvelope` XDR structure.

Quick Fix & Resolution

Ensure the transaction is serialized as a valid base64 TransactionEnvelope XDR and properly URL-encoded when sent via POST /transactions.

Response Payload & SDK Handling ​

json
{
  "type": "https://orion.stellarchain.io/horizon-errors/transaction_malformed",
  "title": "Transaction Malformed",
  "status": 400,
  "detail": "Horizon could not decode the transaction envelope in this request. A transaction should be an XDR TransactionEnvelope struct encoded using base64. The envelope read from this request is echoed in the `extras.envelope_xdr` field of this response for your convenience.",
  "extras": {
    "envelope_xdr": "BBBBBPORy3CoX6ox2ilbeiVjBA5WlpCSZRcjZ7VE9Wf4QVk7..."
  }
}
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_malformed') {
    console.error('[transaction_malformed] 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 ​

  • The tx parameter was empty or not URL-encoded (+ characters in base64 must be URL-encoded as %2B in application/x-www-form-urlencoded bodies).
  • Truncated base64 string or leftover trailing bytes in the XDR buffer.

← Back to All 23 Horizon Error Codes

Open-Source Stellar Horizon & Orion Documentation under MIT License.