> For the complete documentation index, see [llms.txt](https://docs.aqua.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aqua.network/developers/reference/error-codes.md).

# Error codes

When a contract call fails, the simulation (or transaction) reports a numeric error code, for example, `Error(Contract, #2006)`. The codes below cover the errors an integrator is most likely to encounter.

## Swap & liquidity guards

The errors you should expect and handle in normal operation:

| Code   | Name                  | When it happens                                                                                                            | How to handle                                           |
| ------ | --------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `2006` | `OutMinNotSatisfied`  | Exact-input swap: output fell below your `out_min`. Also raised on deposits (`min_shares`) and withdrawals (`min_amounts`) | Re-quote and retry; consider a wider slippage tolerance |
| `2020` | `InMaxNotSatisfied`   | Exact-output swap: required input exceeds your `max_in`                                                                    | Re-quote and retry                                      |
| `2005` | `InMinNotSatisfied`   | Exact-output swap at pool level: output below minimum                                                                      | Re-quote and retry                                      |
| `2018` | `ZeroAmount`          | Zero passed as a swap/deposit amount                                                                                       | Validate input before calling                           |
| `2019` | `InsufficientBalance` | Account balance can't cover the transfer                                                                                   | Check balances before submitting                        |

For multi-hop swaps (`swap_chained`), the slippage guard is enforced **end-to-end** — intermediate hops are unconstrained; only the final output is checked against `out_min`.

## Routing & setup errors

Usually indicate a bug in the integration rather than market conditions:

| Code   | Name              | When it happens                                   | How to handle                                                                                   |
| ------ | ----------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `301`  | `PoolNotFound`    | No pool exists for the given tokens + pool hash   | Re-discover pools via `get_pools(tokens)`                                                       |
| `302`  | `BadFee`          | Fee tier not in the allowed set for the pool type | Use 10 / 30 / 100 bps (volatile & concentrated)                                                 |
| `307`  | `PathIsEmpty`     | `swap_chained` called with an empty swaps chain   | Always pass the XDR from the Find Path API                                                      |
| `2002` | `TokensNotSorted` | Token vector not sorted by contract address       | Sort with the `order_token_ids` [helper](/developers/code-examples/prerequisites-and-basics.md) |

## Pause states

Aquarius contracts have independent kill switches for emergency response. If operations are paused you'll see: `205 PoolDepositKilled`, `206 PoolSwapKilled`, `207 PoolClaimKilled` (standard pools), or `2139 GaugesClaimKilled` (concentrated pool incentives). These are not integration bugs — check [Discord](https://discord.gg/sgzFscHp4C) for status.

## Concentrated-pool specific

| Code   | Name                    | When it happens                              |
| ------ | ----------------------- | -------------------------------------------- |
| `2121` | `InsufficientLiquidity` | The swap exhausted all liquidity in the pool |

## API-level failures

The backend API signals differently — see [Backend API](/developers/reference/backend-api.md): no route is HTTP `200` + `success: false`; invalid input is HTTP `400`.

{% hint style="info" %}
**Parsing results:** since Stellar protocol 23, transaction metadata uses **version 4** (`TransactionMetaV4`). Code that reads `meta.v3.soroban_meta` directly will find `None` — use the version-aware pattern shown in the [code examples](/developers/code-examples.md), or `meta.value().sorobanMeta()` in JavaScript.
{% endhint %}
