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

# Errors

> Every swap program error, what causes it, and what to do about it.

When an instruction fails, the transaction logs name the error, as in `Error Code: AmountOutTooLow`. `client.parseSwapError(error)` reads the same name from a failed send or simulation. Match on the name, not the number.

## Swaps

| Error | Cause | What to do |
| - | - | - |
| `ProgramPaused` | The program is paused | Wait until Multiliquid unpauses it |
| `PairPaused` | The capital provider paused the pair | Use another pair, or wait |
| `RwaPaused` | The pair's base token is paused | Use another pair, or wait |
| `StablePaused` | The pair's quote token, or the capital provider's stablecoin setting, is paused | Use another pair, or wait |
| `FeeAssetPaused` | The fee token is paused | Wait until Multiliquid unpauses it |
| `AmountOutTooLow` | The output is below `min_amount_out`, or below `amount` for `ExactOut`, or the user received less than that | Quote again, and let the user accept the new price |
| `AmountInTooHigh` | The input is above `max_amount_in` | Quote again, and let the user accept the new price |
| `AmountMustBePositive` | `amount` is zero | Pass a positive amount |
| `AmountInMustBePositive`, `AmountOutMustBePositive` | The input or output rounds to zero | Swap a larger amount |
| `SwapAmountTooSmall` | A protocol fee rate is set, but the fee rounds to zero | Swap a larger amount |
| `DiscountMustBePositive` | The pair fee is set, but rounds to zero | Swap a larger amount |
| `FeesOutOfRange` | The pair fee and spread rate together reach 100% | Don't offer the pair; its fees are misconfigured |
| `InsufficientLpFeeBalance` | The capital provider's fee account cannot pay the protocol fee | Use another capital provider, or ask this one to fund its fee account |
| `MissingLpStableConfig` | A `Stable` side has no capital provider stablecoin setting | Build with the SDK, which passes it |
| `SignerInRemainingAccounts` | A remaining account is marked as a signer | Pass remaining accounts as non-signers |
| `MathOverflow`, `MathUnderflow` | The amount is too large or too small to compute | Change the amount |

## Prices

| Error | Cause | What to do |
| - | - | - |
| `InvalidNav` | A NAV is zero, the sources diverge, or a Pyth or Redstone update is stale or unreadable | Try again later. Don't widen the bound to get around it. |
| `NavMustBePositive` | A price source returned zero or less | Try again later |
| `ConfidenceTooLow` | A Pyth confidence interval is wider than the source allows | Try again later |
| `InvalidAccountPublicKey` | A price-source account is missing from the remaining accounts, or another account is not the expected one | Build with the SDK, which adds them |
| `MissingRedstoneAccount` | A Redstone account is missing from the remaining accounts | Build with the SDK, which adds them |
| `InvalidNavAccountOwner` | A Pyth account is not owned by the Pyth receiver | Pass the configured price update account |
| `FeedIdMismatch` | A price account carries another feed | Pass the configured price account |
| `NavAccountDataTooShort` | A fixed-address price account is shorter than the configured offset | Ask Multiliquid to check the source |
| `RedstoneValueTooLarge` | A Redstone price does not fit a `u64` | Ask Multiliquid to check the source |

## Pairs and liquidity

| Error | Cause | What to do |
| - | - | - |
| `OutOfRange` | A pair fee is above 9,900, or the two reach 10,000 | Lower the fees |
| `NonCanonicalTokenOrder` | The quote mint sorts after the base mint in `init_pair` | Build with the SDK, which sorts the mints |
| `InvalidAssetType` | The two mints are the same, or a stablecoin setting is passed for an `Rwa` side | Build with the SDK |
| `InsufficientLiquidity` | `remove_liquidity` asks for more than the vault holds | Withdraw at most the vault's balance |
| `Unauthorized` | The signer may not make this change | Sign with the capital provider's or the admin's wallet, as the instruction requires |
| `TreasuryBalanceNonZero` | `close_pair` while the Treasury position holds value | Withdraw the position with `remove_liquidity` first |
| `MissingTreasuryAccounts` | Treasury routing applies, but its accounts are missing | Build with the SDK |
| `InvalidTreasuryProgram` | The Treasury program account is not the Treasury program | Build with the SDK |
| `InvalidTreasuryMint` | The \$TSY mint is not Treasury's configured mint | Pass the configured mint |
| `LpVaultAuthorityUnderfunded` | The vault authority lacks the SOL for a first Treasury deposit's rent | Turn routing on again with `set_lp_treasury_enabled`, which tops it up |

## Administration

| Error | Cause |
| - | - |
| `UnauthorizedInitializer` | `init_global_config` was not signed by the upgrade authority |
| `InvalidNewAdmin` | The proposed admin is the current one, or no admin is proposed |
| `AssetConfigInUse` | `asset_type` changed while pairs use the token |
| `MustProvideAtLeastOneNavData`, `Max5NavData` | A token has no price sources, or more than five |
| `MustProvideHardcodedPrice` | A fixed price is zero |
| `PriceDecimalsTooLarge` | A price source has more than 9 decimals |
| `InvalidFeedId` | A feed ID is all zeros |
| `InvalidMaxAge`, `MaxAgeTooLarge` | A maximum age is zero, or above 24 hours |
| `ConfBpsTooLarge` | A Pyth confidence limit is above 1,000 basis points |
| `MissingPythAccount` | A Pyth account is missing at registration |
| `DuplicateNavSource` | Two price sources repeat an account, a feed, or a fixed price |

## Tokens

| Error | Cause | What to do |
| - | - | - |
| `TransferFeeNotSupported` | The mint charges a Token-2022 transfer fee | The program does not support such mints |
| `InvalidTokenExtensionData` | A Token-2022 mint or account could not be decoded | Check the account passed |

A transfer can also fail inside the token program, outside these errors: `insufficient funds` when the user or the vault lacks the tokens, or an issuer's rejection when a wallet or vault is frozen or not admitted.

## Framework errors

Anchor checks accounts before the program runs. The common failures:

| Error | Cause |
| - | - |
| `AccountNotInitialized` | A required account does not exist, such as a capital provider's fee account or a vault |
| `ConstraintSeeds` | An account is not the PDA the seeds give |
| `ConstraintHasOne` | A signer or account does not match the one the config records, such as a non-admin calling an admin instruction |
| `ConstraintTokenOwner`, `ConstraintTokenMint` | A token account has the wrong owner or mint |

## Error numbers

Program errors are numbered from 6000 in the order the [IDL](https://docs.multiliquid.xyz/svm/idl.md) lists them. Price-source errors come from code shared with the Treasury program and keep their own numbers, which overlap: a missing Redstone account is logged as `MissingRedstoneAccount` with number 6034, the number the IDL gives `FeedIdMismatch`. The name in the log is always right. `parseSwapError` checks both the name and the number.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.