Skip to content

Bad Request (bad_request) ​

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

The request you sent was invalid in some way (e.g. malformed query parameter, invalid cursor, invalid asset format, or out-of-range limit).

Quick Fix & Resolution

Inspect extras.invalid_field and extras.reason in the JSON response body and adjust the query parameter to match the endpoint specification.

Response Payload & SDK Handling ​

json
{
  "type": "https://orion.stellarchain.io/horizon-errors/bad_request",
  "title": "Bad Request",
  "status": 400,
  "detail": "The request you sent was invalid in some way.",
  "extras": {
    "invalid_field": "limit",
    "reason": "limit must be between 1 and 200"
  }
}
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/bad_request') {
    console.error('[bad_request] 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 ​

  • A query parameter (limit, cursor, order, asset, account_id) failed validation.
  • On /accounts, asset=native was requested (Horizon and Orion do not allow filtering all accounts by native XLM).
  • On /trade_aggregations, resolution, offset, or time range parameters are invalid.
  • An asset string was not formatted as CODE:ISSUER or native.

← Back to All 23 Horizon Error Codes

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