> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hadron.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Error Reference

> All Hadron program error codes and what they mean.

When a transaction fails, the program returns a custom error code. Match the code from your transaction logs to this table.

## Common errors

| Code | Name                    | Description                                                           |
| ---- | ----------------------- | --------------------------------------------------------------------- |
| 4    | `Unauthorized`          | Signer is not the pool authority                                      |
| 7    | `InsufficientLiquidity` | Not enough liquidity in the pool to fill the swap                     |
| 8    | `SlippageExceeded`      | Output amount is below `minOut`                                       |
| 15   | `ZeroSwapAmount`        | Swap input amount is zero                                             |
| 16   | `PoolPaused`            | Pool is paused — no swaps or deposits allowed                         |
| 37   | `StaleOracle`           | Oracle hasn't been updated recently enough (exceeds `deltaStaleness`) |
| 38   | `Expired`               | Transaction slot deadline has passed                                  |

## All error codes

| Code | Name                                     | Description                                                                                   |
| ---- | ---------------------------------------- | --------------------------------------------------------------------------------------------- |
| 0    | `NotSigner`                              | Account is not a signer                                                                       |
| 1    | `InvalidOwner`                           | Account has wrong owner                                                                       |
| 2    | `InvalidAccountData`                     | Account data is malformed or wrong size                                                       |
| 3    | `InvalidAddress`                         | Account address doesn't match expected PDA                                                    |
| 4    | `Unauthorized`                           | Signer is not the pool authority                                                              |
| 5    | `PoolNotInitialized`                     | Pool has not been initialized yet                                                             |
| 6    | `PoolAlreadyInitialized`                 | Pool has already been initialized                                                             |
| 7    | `InsufficientLiquidity`                  | Not enough liquidity to fill the swap                                                         |
| 8    | `SlippageExceeded`                       | Output amount is below `minOut`                                                               |
| 9    | `CurvePointsNotSorted`                   | Curve points must be sorted by ascending x value                                              |
| 10   | `CurveDuplicateX`                        | Curve has duplicate x values                                                                  |
| 11   | `CurveTooManyPoints`                     | Curve exceeds the max points limit                                                            |
| 12   | `CurveEmpty`                             | Curve has zero points                                                                         |
| 13   | `InvalidMidprice`                        | Midprice value is invalid                                                                     |
| 14   | `MathOverflow`                           | Arithmetic overflow during calculation                                                        |
| 15   | `ZeroSwapAmount`                         | Swap input amount is zero                                                                     |
| 16   | `PoolPaused`                             | Pool is paused                                                                                |
| 17   | `FeeConfigAlreadyInitialized`            | Global fee config already exists                                                              |
| 18   | `FeeConfigNotInitialized`                | Global fee config doesn't exist yet                                                           |
| 19   | `NotFeeAdmin`                            | Signer is not the fee admin                                                                   |
| 20   | `InvalidFeePpm`                          | Fee PPM value is out of range                                                                 |
| 21   | `RiskCurveXOutOfRange`                   | Risk curve x-value must be between 0 and Q32\_ONE                                             |
| 22   | `SequenceTooOld`                         | Oracle update sequence must be >= current sequence                                            |
| 23   | `PrefabSlotOutOfRange`                   | Prefab slot index exceeds pool's max slots                                                    |
| 25   | `PrefabSlotNotInitialized`               | Target prefab slot has no curve data                                                          |
| 27   | `SpreadConfigAlreadyInitialized`         | Spread config already exists                                                                  |
| 28   | `SpreadConfigNotInitialized`             | Spread config doesn't exist yet                                                               |
| 29   | `TooManySpreadTriggers`                  | Too many spread triggers                                                                      |
| 30   | `SpreadConfigRequired`                   | Pool has spread config but it wasn't provided in accounts                                     |
| 31   | `SpreadConfigInvalidOwner`               | Spread config account not owned by program                                                    |
| 32   | `ConfigInvalidOwner`                     | Config account not owned by program                                                           |
| 33   | `MidpriceOracleInvalidOwner`             | Oracle account not owned by program                                                           |
| 34   | `CurveMetaInvalidOwner`                  | CurveMeta account not owned by program                                                        |
| 35   | `CurvePrefabsInvalidOwner`               | CurvePrefabs account not owned by program                                                     |
| 36   | `FeeConfigInvalidOwner`                  | FeeConfig account not owned by program                                                        |
| 37   | `StaleOracle`                            | Oracle hasn't been updated within `deltaStaleness` slots                                      |
| 38   | `Expired`                                | Transaction slot deadline has passed                                                          |
| 39   | `NoPendingNomination`                    | No pending authority transfer to accept                                                       |
| 40   | `NominationExpired`                      | Authority nomination has expired                                                              |
| 41   | `InvalidNominee`                         | Signer is not the nominated authority                                                         |
| 42   | `NominateSelf`                           | Cannot nominate current authority as new authority                                            |
| 43   | `InvalidNominationExpiry`                | Nomination expiry slot must be in the future                                                  |
| 44   | `InvalidTokenProgram`                    | Must be SPL Token or Token-2022                                                               |
| 45   | `PriceCurveXOutOfRange`                  | Price curve x-value out of range in percent mode                                              |
| 46   | `CurveUpdatesBufferFull`                 | Curve updates buffer is full — apply before submitting more                                   |
| 47   | `CurveUpdatesInvalidOwner`               | CurveUpdates account not owned by program                                                     |
| 48   | `CurveMetaMismatch`                      | CurveMeta address doesn't belong to this pool                                                 |
| 50   | `InvalidRiskMode`                        | Risk mode must be 0 (Virtual) or 1 (Integrated)                                               |
| 51   | `IntegratedRiskUnsupportedInterpolation` | Integrated risk mode doesn't support this interpolation type                                  |
| 52   | `VaultsNotEmpty`                         | Vaults must be empty before closing pool                                                      |
| 53   | `InvalidPoolState`                       | Pool state must be 1 (Initialized), 2 (Paused), or 3 (RejectSwaps) and different from current |
| 54   | `MaxPrefabSlotsOutOfRange`               | Max prefab slots must be 1–16                                                                 |
| 55   | `MaxCurvePointsOutOfRange`               | Max curve points must be 1–128                                                                |
| 56   | `VaultAddressMismatch`                   | Vault address does not match derived PDA                                                      |
| 57   | `VaultTokenAccountTooSmall`              | Vault token account data too small                                                            |
| 58   | `UserTokenAccountTooSmall`               | User token account data too small                                                             |
| 59   | `VaultMintMismatch`                      | Vault token account mint does not match config                                                |
| 60   | `UserTokenAccountInvalid`                | User token account has wrong owner or mint                                                    |
| 61   | `ConcavityViolation`                     | Curve interpolation params violate output concavity constraints                               |
| 62   | `PriceFactorTooLarge`                    | Price factor exceeds 1.0 (Q32\_ONE) — price curves must have factors ≤ 1.0                    |
| 63   | `PoolFeeConfigAlreadyInitialized`        | Pool fee config already initialized                                                           |
| 64   | `PoolFeeConfigNotInitialized`            | Pool fee config not initialized                                                               |
| 66   | `AssetFeeCapExceeded`                    | Per-asset-pair fee table is full (max entries reached)                                        |
| 67   | `CurveUpdateSlotMismatch`                | Curve update `target_slot` does not match the active slot for the op's curve type             |
| 68   | `RiskCurveMonotonicityViolation`         | Risk curve is not monotone (segment shape or factor sequence)                                 |
| 70   | `InvalidTriggerSpreadBps`                | Spread trigger `spread_bps` must be non-zero                                                  |
| 71   | `PoolAlreadyClosed`                      | Pool is closed (terminal state) — operation not permitted                                     |
| 72   | `CurveUpdateExpectedXMismatch`           | Curve update `expected_x_in` does not match the current point at `point_index`                |
| 73   | `ValidationSimulationSuccess`            | `ValidateCurveUpdates` dry-run succeeded (intentional revert; surfaced via simulation)        |
| 74   | `NotDepositAuthority`                    | Signer is not the deposit authority                                                           |
| 75   | `NotWithdrawAuthority`                   | Signer is not the withdraw authority                                                          |
| 76   | `RotateToZero`                           | Rotation target is the zero pubkey                                                            |
| 77   | `RotateNoOp`                             | Rotation target equals the current authority (no-op)                                          |
| 78   | `DrawdownGuardDisabled`                  | Drawdown guard is disabled                                                                    |
