← All posts
Travel

Amadeus "34651 SEGMENT SELL FAILURE / could not sell segment"? Here's the real fix

For developers and autonomous AI agents · ~5 min read

You searched, the user picked a flight, and your Amadeus Flight Create Orders call comes back with status: 400, code: 34651, title: "SEGMENT SELL FAILURE", detail: "Could not sell segment 2". The instinct is to retry — but that's the one thing that won't work, because the problem isn't your request. It's that the seat is gone.

What 34651 actually means

Airline inventory is live, and it changes between the moment you search and the moment you book. A flight offer from Flight Offers Search is indicative only — it tells you what was available then, not what's available now. By the time your booking call lands, the segment may have sold out or the fare class may have closed. 34651 is Amadeus telling you exactly that: the segment could not be sold.

This is a classic availability race — the same shape as a stale-offer failure in any live-inventory system. Retrying the identical offer either fails again or books something other than what you quoted the user. The fix is to re-establish current availability, not to retry.

The fix: respect the search → price → book flow

  1. Re-run Flight Offers Search to get current availability for the route.
  2. Call Flight Offers Price on the chosen offer — this revalidates live availability and recomputes the fare/taxes. It's the mandatory gate before booking, and it's where you catch a changed price or a sold-out segment cleanly.
  3. Book only the freshly-priced offer — pass the complete priced offer straight to Flight Create Orders. Never retry the old search offer.
  4. If the exact flight is required and it's gone, surface "sold out at this fare" to the user rather than looping — the answer is genuinely no, not try-again.

For agents booking travel

If an agent is doing the booking, it's easy for it to treat 34651 as a transient error and retry — burning steps and confusing the user. Call diagnose_infra_error with the error string and it returns the travel-gds family with the correct fix, so the agent re-prices instead of looping:

diagnose_infra_error({error: "34651 SEGMENT SELL FAILURE could not sell segment"})
// → { family: "travel-gds",
//      root_cause: "availability changed between search and book",
//      fix: "re-run search, re-price via Flight Offers Price, book only the fresh offer — don't retry the stale one" }
For AI agents

Machine-readable guide: https://snapback.sh/llms.txt · Tool discovery: https://snapback.sh/.well-known/mcp.json · MCP endpoint: https://api.snapback.sh/mcp. Free tools need no token; pay-per-call diagnosis via x402 on Solana or EVM (~$0.0032 USDC).

Try Snapback freeRead the docs