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

# Error codes

> Anchor error enums for every Raydium on-chain program, with cause and recommended UX message.

<Info>
  **Source of truth.** The tables below are regenerated from each program's `error.rs` in the public Raydium repositories. When a program is upgraded and a new variant is added, re-run the extraction (link at the bottom of each table) and append to the table rather than reshuffling — Anchor error codes are assigned by **source order**, not name, so rearranging breaks integrator error-handling.
</Info>

## How Anchor error codes work

Anchor assigns each variant of a program's `ErrorCode` enum a numeric code starting at `6000`. A failing transaction surfaces:

* **Numeric error code** (e.g. `0x1771` = 6001) in the transaction logs.
* **Error name** (e.g. `InvalidOwner`) from the IDL.
* **`#[msg(...)]` string** that Anchor emitted in `log_messages`.

Integrators should match on the **numeric code**, not the message string (the string can be re-worded without bumping a version).

```ts theme={null}
// Example: detect the CPMM slippage error and surface a clean UX message.
const CPMM_EXCEEDED_SLIPPAGE = 6005;

try {
  await sdk.cpmm.swap({ ... });
} catch (err: any) {
  const code = err?.error?.errorCode?.number ?? err?.code;
  if (code === CPMM_EXCEEDED_SLIPPAGE) {
    showToast("Price moved past your slippage tolerance. Increase slippage or retry.");
    return;
  }
  throw err;
}
```

## CPMM (Standard AMM) errors

Program ID: see [reference/program-addresses](/reference/program-addresses#on-chain-programs). Source: `raydium-cp-swap/programs/cp-swap/src/error.rs`.

| Code | Variant                        | `#[msg]` string                                                                        | Typical cause                                                                                                        | Recommended UX                                                          |
| ---- | ------------------------------ | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| 6000 | `NotApproved`                  | Not approved                                                                           | Caller is not the configured authority for an admin instruction.                                                     | "Only the pool admin can perform this action."                          |
| 6001 | `InvalidOwner`                 | Input account owner is not the program address                                         | A passed-in account is owned by the wrong program (often a wrong token program or a wrong-program PDA).              | "Internal: account owner mismatch — refresh and retry."                 |
| 6002 | `EmptySupply`                  | Input token account empty                                                              | LP or token account balance is zero at a step that requires a positive amount.                                       | "Nothing to withdraw."                                                  |
| 6003 | `InvalidInput`                 | InvalidInput                                                                           | Generic bad argument (amount out of range, wrong flag).                                                              | "Invalid input — check amounts and try again."                          |
| 6004 | `IncorrectLpMint`              | Address of the provided lp token mint is incorrect                                     | The LP mint account passed in does not match `pool_state.lp_mint`.                                                   | "Internal: wrong LP mint — refresh pool data."                          |
| 6005 | `ExceededSlippage`             | Exceeds desired slippage limit                                                         | The executed price is worse than the user's `minAmountOut` / `maxAmountIn`.                                          | "Price moved past your slippage tolerance. Increase slippage or retry." |
| 6006 | `ZeroTradingTokens`            | Given pool token amount results in zero trading tokens                                 | Deposit / withdraw math rounded one side to zero (position too small).                                               | "Amount is below the minimum for this pool."                            |
| 6007 | `NotSupportMint`               | Not support token\_2022 mint extension *(grammar in source)*                           | Pool encountered a Token-2022 extension it cannot handle safely (e.g. `TransferHook`, `DefaultAccountState=Frozen`). | "This token has an extension Raydium does not support in CPMM."         |
| 6008 | `InvalidVault`                 | invaild vault *(typo in source)*                                                       | The passed vault account does not match the one recorded in `pool_state`.                                            | "Internal: wrong vault — refresh and retry."                            |
| 6009 | `InitLpAmountTooLess`          | Init lp amount is too less(Because 100 amount lp will be locked) *(grammar in source)* | At pool initialization, the computed LP supply is below the permanent-lock amount.                                   | "Initial liquidity too small. Increase deposit."                        |
| 6010 | `TransferFeeCalculateNotMatch` | TransferFee calculate not match                                                        | The observed post-transfer amount for a Token-2022 fee mint did not match the pre-computed expectation.              | "Token transfer fee changed mid-transaction. Retry."                    |
| 6011 | `MathOverflow`                 | Math overflow                                                                          | An intermediate swap / deposit / fee calculation overflowed.                                                         | "Amount is too large for this pool."                                    |
| 6012 | `InsufficientVault`            | Insufficient vault                                                                     | Pool vault balance is too low to cover the requested output.                                                         | "Not enough liquidity in the pool for this size."                       |
| 6013 | `InvalidFeeModel`              | Invalid fee model                                                                      | Admin set an `AmmConfig` parameter combination that is rejected on-chain.                                            | N/A — admin-only path.                                                  |
| 6014 | `NoFeeCollect`                 | Fee is zero                                                                            | `collect_protocol_fee` / `collect_fund_fee` called with zero collectable fees.                                       | N/A — admin path; tooling should swallow.                               |

Regeneration source: [github.com/raydium-io/raydium-cp-swap — error.rs](https://github.com/raydium-io/raydium-cp-swap/blob/master/programs/cp-swap/src/error.rs).

## CLMM errors

Program ID: see [reference/program-addresses](/reference/program-addresses#on-chain-programs). Source: `raydium-clmm/programs/amm/src/error.rs`.

| Code | Variant                                  | `#[msg]` string                                                                         | Typical cause                                                                                                                                           | Recommended UX                                                                          |
| ---- | ---------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| 6000 | `NotApproved`                            | Not approved                                                                            | Caller is not the configured admin for this instruction.                                                                                                | "Only the pool admin can perform this action."                                          |
| 6001 | `InvalidUpdateConfigFlag`                | invalid update amm config flag                                                          | Admin passed an unrecognized `param` value to `update_amm_config`.                                                                                      | N/A — admin-only path.                                                                  |
| 6002 | `AccountLack`                            | Account lack                                                                            | Required remaining account missing from the tx (typically tick-array or oracle extension).                                                              | "Internal: missing account — refresh pool data."                                        |
| 6003 | `ClosePositionErr`                       | Remove liquidity, collect fees owed and reward then you can close position account      | Tried to close a position that still has liquidity, uncollected fees, or uncollected rewards.                                                           | "Withdraw all liquidity and claim fees/rewards before closing the position."            |
| 6004 | `InvalidTickIndex`                       | Tick out of range                                                                       | `tick_lower` or `tick_upper` is outside `[-443636, 443636]`.                                                                                            | "Price range out of bounds for this pool."                                              |
| 6005 | `TickInvalidOrder`                       | The lower tick must be below the upper tick                                             | `tick_lower >= tick_upper`.                                                                                                                             | "Lower price must be below upper price."                                                |
| 6006 | `TickLowerOverflow`                      | The tick must be greater, or equal to the minimum tick(-443636)                         | Lower tick underflow.                                                                                                                                   | "Lower price too low."                                                                  |
| 6007 | `TickUpperOverflow`                      | The tick must be lesser than, or equal to the maximum tick(443636)                      | Upper tick overflow.                                                                                                                                    | "Upper price too high."                                                                 |
| 6008 | `TickAndSpacingNotMatch`                 | tick % tick\_spacing must be zero                                                       | Submitted tick is not a multiple of the pool's `tick_spacing`.                                                                                          | "Snap price to the nearest valid increment."                                            |
| 6009 | `InvalidTickArray`                       | Invalid tick array account                                                              | Wrong PDA passed for a tick-array slot.                                                                                                                 | "Internal: wrong tick array — refresh pool data."                                       |
| 6010 | `InvalidTickArrayBoundary`               | Invalid tick array boundary                                                             | Off-by-one in tick-array indexing.                                                                                                                      | "Internal: tick-array boundary error."                                                  |
| 6011 | `SqrtPriceLimitOverflow`                 | Square root price limit overflow                                                        | Caller-supplied `sqrt_price_limit` outside valid range.                                                                                                 | "Price limit out of range."                                                             |
| 6012 | `SqrtPriceX64`                           | sqrt\_price\_x64 out of range                                                           | Pool's current sqrt price drifted out of range mid-swap.                                                                                                | "Retry swap."                                                                           |
| 6013 | `LiquiditySubValueErr`                   | Liquidity sub delta L must be smaller than before                                       | Internal invariant violation on decrease-liquidity.                                                                                                     | "Internal: liquidity accounting error."                                                 |
| 6014 | `LiquidityAddValueErr`                   | Liquidity add delta L must be greater, or equal to before                               | Internal invariant violation on increase-liquidity.                                                                                                     | "Internal: liquidity accounting error."                                                 |
| 6015 | `ForbidBothZeroForSupplyLiquidity`       | Both token amount must not be zero while supply liquidity                               | Increase-liquidity call with both `amount_0_max` and `amount_1_max` zero.                                                                               | "Provide at least one token."                                                           |
| 6016 | `LiquidityInsufficient`                  | Liquidity insufficient                                                                  | Position does not have enough liquidity to satisfy the withdrawal.                                                                                      | "Withdraw amount exceeds position liquidity."                                           |
| 6017 | `PriceSlippageCheck`                     | Price slippage check                                                                    | Execution price failed the caller's slippage guard.                                                                                                     | "Price moved past your slippage tolerance. Increase slippage or retry."                 |
| 6018 | `TooLittleOutputReceived`                | Too little output received                                                              | `SwapBaseInput`: out amount below `other_amount_threshold`.                                                                                             | "Slippage exceeded — minimum output not met."                                           |
| 6019 | `TooMuchInputPaid`                       | Too much input paid                                                                     | `SwapBaseOutput`: in amount above `other_amount_threshold`.                                                                                             | "Slippage exceeded — maximum input exceeded."                                           |
| 6020 | `ZeroAmountSpecified`                    | Swap special amount can not be zero                                                     | Zero `amount` on a swap instruction.                                                                                                                    | "Enter an amount greater than zero."                                                    |
| 6021 | `InvalidInputPoolVault`                  | Input pool vault is invalid                                                             | Swap's input-vault account does not match the pool's recorded vault.                                                                                    | "Internal: wrong input vault — refresh pool data."                                      |
| 6022 | `TooSmallInputOrOutputAmount`            | Swap input or output amount is too small                                                | Swap math rounded to zero, typically very small dust.                                                                                                   | "Amount too small to swap in this pool."                                                |
| 6023 | `NotEnoughTickArrayAccount`              | Not enough tick array account                                                           | Not enough tick-array remaining accounts supplied for the swap range.                                                                                   | "Internal: insufficient tick-arrays — refresh pool data."                               |
| 6024 | `InvalidFirstTickArrayAccount`           | Invalid first tick array account                                                        | The first tick-array account passed does not cover the current tick.                                                                                    | "Internal: wrong first tick array — refresh pool data."                                 |
| 6025 | `InvalidRewardIndex`                     | Invalid reward index                                                                    | `reward_index` outside `[0, 2]`.                                                                                                                        | N/A — admin path.                                                                       |
| 6026 | `FullRewardInfo`                         | The init reward token reach to the max                                                  | Pool already has the max (3) reward mints configured.                                                                                                   | N/A — admin path.                                                                       |
| 6027 | `RewardTokenAlreadyInUse`                | The init reward token already in use                                                    | Reward mint duplicates an existing one.                                                                                                                 | N/A — admin path.                                                                       |
| 6028 | `ExceptRewardMint`                       | The reward tokens must contain one of pool vault mint except the last reward            | Pre-slot 2, reward mint must equal one of the pool's vault mints.                                                                                       | N/A — admin path.                                                                       |
| 6029 | `InvalidRewardInitParam`                 | Invalid reward init param                                                               | Bad emission start/end time or per-second rate.                                                                                                         | N/A — admin path.                                                                       |
| 6030 | `InvalidRewardInputAccountNumber`        | Invalid collect reward input account number                                             | Wrong number of remaining accounts passed to `CollectReward`.                                                                                           | "Internal: wrong account count — refresh and retry."                                    |
| 6031 | `InvalidRewardPeriod`                    | Invalid reward period                                                                   | Reward emission period invalid (`end <= start`, zero duration).                                                                                         | N/A — admin path.                                                                       |
| 6032 | `NotApproveUpdateRewardEmissions`        | Modification of emissions is allowed within 72 hours from the end of the previous cycle | Admin tried to modify emissions outside the 72-hour window around cycle boundaries.                                                                     | N/A — admin path.                                                                       |
| 6033 | `UnInitializedRewardInfo`                | uninitialized reward info                                                               | Reward slot not initialized but referenced.                                                                                                             | N/A — admin path.                                                                       |
| 6034 | `NotSupportMint`                         | Not support token\_2022 mint extension                                                  | CLMM encountered a Token-2022 extension it cannot handle.                                                                                               | "This token has an extension Raydium CLMM does not support."                            |
| 6035 | `MissingTickArrayBitmapExtensionAccount` | Missing tickarray bitmap extension account                                              | Swap crossed a tick range not covered by the base bitmap; extension bitmap account required.                                                            | "Internal: missing tick-array extension — refresh pool data."                           |
| 6036 | `InsufficientLiquidityForDirection`      | Insufficient liquidity for this direction                                               | Not enough liquidity exists in the direction of the swap.                                                                                               | "Insufficient liquidity for this swap size."                                            |
| 6037 | `MaxTokenOverflow`                       | Max token overflow                                                                      | Input/output amount exceeded u64.                                                                                                                       | "Amount too large for this pool."                                                       |
| 6038 | `CalculateOverflow`                      | Calculate overflow                                                                      | Fee / liquidity arithmetic overflow.                                                                                                                    | "Amount too large for this pool."                                                       |
| 6039 | `TransferFeeCalculateNotMatch`           | TransferFee calculate not match                                                         | Token-2022 transfer fee observed amount did not match expected.                                                                                         | "Token transfer fee changed mid-transaction. Retry."                                    |
| 6040 | `OrderAlreadyFilled`                     | Order already fully filled, cannot modify                                               | `IncreaseLimitOrder` / `DecreaseLimitOrder` called on an order whose unfilled portion is zero.                                                          | "This limit order is already filled — settle to receive output."                        |
| 6041 | `InvalidOrderPhase`                      | Invalid order phase                                                                     | Mutating an order whose FIFO cohort phase no longer matches the tick's current cohort.                                                                  | "Cannot perform this action in the order's current state."                              |
| 6042 | `InvalidLimitOrderAmount`                | Invalid limit order amount                                                              | Order input below the pool's minimum (or zero) at open / increase / decrease time.                                                                      | "Order size is below the pool's minimum."                                               |
| 6043 | `OrderPhaseSaturated`                    | Tick order phase saturated                                                              | The cohort's `order_phase` counter on the tick has saturated; further orders cannot be opened at that tick until existing cohorts settle and roll over. | "Too many active orders at this price; try a nearby tick or wait for orders to settle." |
| 6044 | `InvalidDynamicFeeConfigParams`          | Invalid dynamic fee config params                                                       | `CreateDynamicFeeConfig` / `UpdateDynamicFeeConfig` rejected; or `CreateCustomizablePool` enabled dynamic fee without a valid config.                   | N/A on admin path; "Dynamic fee config invalid" on user path.                           |
| 6045 | `InvalidFeeOn`                           | Invalid fee on which token (must be 0, 1, or 2)                                         | `CreateCustomizablePool` passed a `collect_fee_on` value outside `{0, 1, 2}`.                                                                           | "Internal: invalid fee mode."                                                           |
| 6046 | `ZeroSqrtPrice`                          | sqrt\_price\_x64 must be greater than 0                                                 | `CreateCustomizablePool` (or another path that accepts a customizable initial sqrt price) was called with `sqrt_price_x64 == 0`.                        | "Initial price must be greater than zero."                                              |
| 6047 | `ZeroLiquidity`                          | liquidity must be greater than 0                                                        | A liquidity-providing path was called with `liquidity == 0` and no compensating amount.                                                                 | "Liquidity amount must be greater than zero."                                           |
| 6048 | `MissingBaseFlag`                        | base\_flag is required when liquidity is zero                                           | An open-position-by-amount path computed `liquidity == 0` and the caller did not supply a `base_flag` to disambiguate which side is the base.           | "Provide either a non-zero liquidity or specify which token is the base."               |
| 6049 | `MissingMintAccount`                     | Mint account is required but not provided                                               | A Token-2022-aware path was called without the input/output mint account that's needed to validate extensions and transfer fees.                        | "Internal: missing mint account — refresh pool data."                                   |
| 6050 | `MissingTokenProgram2022`                | Token-2022 program is required but not provided                                         | Same as above for the SPL-Token-2022 program account.                                                                                                   | "Internal: missing Token-2022 program — refresh and retry."                             |

> **Note on renumbering.** The CLMM `ErrorCode` enum was renumbered in this release: five legacy variants (`LOK`, `ZeroMintAmount`, `InvalidLiquidity`, `TransactionTooOld`, `InvalidRewardDesiredAmount`) and several typos (`Liquitity`, `enought`, `emissiones`) were removed/fixed, and eleven new variants were appended. Because Anchor numbers errors by source order, every code at or after `6000` has shifted relative to pre-release builds. Clients that hard-coded numeric codes against an earlier version need to remap.

Regeneration source: [github.com/raydium-io/raydium-clmm — error.rs](https://github.com/raydium-io/raydium-clmm/blob/master/programs/amm/src/error.rs).

## AMM v4, Farm v3 / v5 / v6, LaunchLab errors

These programs are documented in their respective chapters (see [`products/amm-v4/instructions`](/products/amm-v4/instructions), [`products/farm-staking/instructions`](/products/farm-staking/instructions), [`products/launchlab/instructions`](/products/launchlab/instructions)). Because those programs use a mix of Anchor and plain Solana error surfaces, their error tables live next to the instruction reference rather than here. The codes below are reserved by those chapters:

| Program      | Code range (Anchor only)           | Reference                                                                   |
| ------------ | ---------------------------------- | --------------------------------------------------------------------------- |
| AMM v4       | Custom u32 codes, not Anchor-style | [`products/amm-v4/instructions`](/products/amm-v4/instructions)             |
| Farm v3 / v5 | Custom u32 codes                   | [`products/farm-staking/instructions`](/products/farm-staking/instructions) |
| Farm v6      | 6000+ (Anchor)                     | [`products/farm-staking/instructions`](/products/farm-staking/instructions) |
| LaunchLab    | 6000+ (Anchor)                     | [`products/launchlab/instructions`](/products/launchlab/instructions)       |

## Mapping SDK errors to program errors

The official TypeScript SDK wraps on-chain errors into `SendTransactionError` and, for Anchor programs, `AnchorError`:

```ts theme={null}
import { AnchorError } from "@coral-xyz/anchor";

try {
  await sdk.cpmm.swap({ ... });
} catch (err) {
  if (err instanceof AnchorError) {
    console.log(err.error.errorCode.number, err.error.errorCode.code, err.error.errorMessage);
    // 6005 ExceededSlippage "Exceeds desired slippage limit"
  } else {
    // Raw SendTransactionError — inspect err.logs for the "custom program error: 0x..." line.
  }
}
```

If you are not using Anchor client-side, parse the transaction logs:

```
Program <ProgramID> invoke [1]
Program log: AnchorError caused by account: pool_state. Error Code: ExceededSlippage. Error Number: 6005. Error Message: Exceeds desired slippage limit.
```

The pattern `Error Number: (\d+)` is stable across Anchor versions and safe to match.

## Regenerating these tables

When a program is upgraded and adds a new error, re-extract from source:

```bash theme={null}
# Clone and grep the error enum in order.
git clone --depth=1 https://github.com/raydium-io/raydium-cp-swap
awk '/#\[msg\(/{ gsub(/^[ \t]*#\[msg\("|"\)\][ \t]*/,""); m=$0; getline; gsub(/,/,""); gsub(/^[ \t]+/,""); print "6000+++\t" $0 "\t" m }' \
  raydium-cp-swap/programs/cp-swap/src/error.rs
# Replace 6000+++ with monotonically-increasing 6000,6001,... Append new rows to the table above.
```

Always update [`reference/changelog`](/reference/changelog) when a new variant is added, so integrators upgrading the SDK know to refresh their error handlers.

Sources:

* [raydium-cp-swap error.rs (mainnet CPMM)](https://github.com/raydium-io/raydium-cp-swap/blob/master/programs/cp-swap/src/error.rs)
* [raydium-clmm error.rs (mainnet CLMM)](https://github.com/raydium-io/raydium-clmm/blob/master/programs/amm/src/error.rs)
