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.
本頁內容由 AI 自動翻譯,所有內容以英文版本為準。查看英文版 →
資料來源。 下方表格是從各程式公開 Raydium 儲存庫中的
error.rs 自動產生。當程式升級並新增變體時,請重新執行擷取腳本(每個表格底部附有連結),並將新列附加到表格末尾,而非重新排列——Anchor 錯誤代碼是依原始碼順序指派,而非依名稱,重新排列會破壞整合者的錯誤處理邏輯。Anchor 錯誤代碼的運作方式
Anchor 會為程式的ErrorCode 列舉中每個變體指派從 6000 開始的數字代碼。交易失敗時,會顯示以下資訊:
- 數字錯誤代碼(例如
0x1771= 6001)出現在交易日誌中。 - 錯誤名稱(例如
InvalidOwner)來自 IDL。 #[msg(...)]字串由 Anchor 輸出至log_messages。
CPMM(標準 AMM)錯誤
程式 ID:請參閱 reference/program-addresses。來源:raydium-cp-swap/programs/cp-swap/src/error.rs。
| 代碼 | 變體 | #[msg] 字串 | 典型原因 | 建議的使用者介面訊息 |
|---|---|---|---|---|
| 6000 | NotApproved | Not approved | 呼叫者不是管理員指令所設定的授權身分。 | 「只有資金池管理員才能執行此操作。」 |
| 6001 | InvalidOwner | Input account owner is not the program address | 傳入的帳戶由錯誤的程式所擁有(通常是錯誤的 token 程式或錯誤程式的 PDA)。 | 「內部錯誤:帳戶擁有者不符——請重新整理後再試。」 |
| 6002 | EmptySupply | Input token account empty | LP 或 token 帳戶餘額為零,但當前步驟需要正數金額。 | 「沒有可提領的金額。」 |
| 6003 | InvalidInput | InvalidInput | 通用的錯誤參數(金額超出範圍、錯誤旗標)。 | 「輸入無效——請檢查金額後再試。」 |
| 6004 | IncorrectLpMint | Address of the provided lp token mint is incorrect | 傳入的 LP mint 帳戶與 pool_state.lp_mint 不符。 | 「內部錯誤:LP mint 錯誤——請重新整理資金池資料。」 |
| 6005 | ExceededSlippage | Exceeds desired slippage limit | 執行價格比使用者設定的 minAmountOut / maxAmountIn 更差。 | 「價格超出你的滑點容忍範圍,請提高滑點設定或重試。」 |
| 6006 | ZeroTradingTokens | Given pool token amount results in zero trading tokens | 存款/提款計算將其中一側四捨五入為零(倉位過小)。 | 「金額低於此資金池的最小限制。」 |
| 6007 | NotSupportMint | Not support token_2022 mint extension (原始碼語法有誤) | 資金池遇到無法安全處理的 Token-2022 擴充功能(例如 TransferHook、DefaultAccountState=Frozen)。 | 「此 token 包含 Raydium CPMM 不支援的擴充功能。」 |
| 6008 | InvalidVault | invaild vault (原始碼有拼字錯誤) | 傳入的 vault 帳戶與 pool_state 中記錄的不符。 | 「內部錯誤:vault 錯誤——請重新整理後再試。」 |
| 6009 | InitLpAmountTooLess | Init lp amount is too less(Because 100 amount lp will be locked) (原始碼語法有誤) | 初始化資金池時,計算出的 LP 供應量低於永久鎖倉金額。 | 「初始流動性不足,請增加存款金額。」 |
| 6010 | TransferFeeCalculateNotMatch | TransferFee calculate not match | Token-2022 收費 mint 的轉帳後實際金額與預先計算的預期不符。 | 「Token 轉帳費用在交易過程中發生變動,請重試。」 |
| 6011 | MathOverflow | Math overflow | swap/存款/手續費的中間計算發生溢位。 | 「金額對此資金池而言過大。」 |
| 6012 | InsufficientVault | Insufficient vault | 資金池 vault 餘額不足以支付請求的輸出金額。 | 「此資金池的流動性不足以完成此筆交易。」 |
| 6013 | InvalidFeeModel | Invalid fee model | 管理員設定了被鏈上拒絕的 AmmConfig 參數組合。 | 不適用——僅限管理員路徑。 |
| 6014 | NoFeeCollect | Fee is zero | 呼叫 collect_protocol_fee / collect_fund_fee 時可收集的手續費為零。 | 不適用——管理員路徑;工具應忽略此錯誤。 |
CLMM 錯誤
程式 ID:請參閱 reference/program-addresses。來源:raydium-clmm/programs/amm/src/error.rs。
| 代碼 | 變體 | #[msg] 字串 | 典型原因 | 建議的使用者介面訊息 |
|---|---|---|---|---|
| 6000 | NotApproved | Not approved | 呼叫者不是此指令所設定的管理員。 | 「只有資金池管理員才能執行此操作。」 |
| 6001 | InvalidUpdateConfigFlag | invalid update amm config flag | 管理員傳入了無法識別的 param 值給 update_amm_config。 | 不適用——僅限管理員路徑。 |
| 6002 | AccountLack | Account lack | 交易中缺少必要的剩餘帳戶(通常是 tick-array 或 oracle 擴充)。 | 「內部錯誤:帳戶缺失——請重新整理資金池資料。」 |
| 6003 | ClosePositionErr | Remove liquidity, collect fees owed and reward then you can close position account | 試圖關閉一個仍有流動性、未收取手續費或未領取獎勵的倉位。 | 「請先提取所有流動性並領取手續費/獎勵,再關閉倉位。」 |
| 6004 | InvalidTickIndex | Tick out of range | tick_lower 或 tick_upper 超出 [-443636, 443636] 範圍。 | 「此資金池的價格範圍超出界限。」 |
| 6005 | TickInvalidOrder | The lower tick must be below the upper tick | tick_lower >= tick_upper。 | 「下限價格必須低於上限價格。」 |
| 6006 | TickLowerOverflow | The tick must be greater, or equal to the minimum tick(-443636) | 下限 tick 下溢。 | 「下限價格過低。」 |
| 6007 | TickUpperOverflow | The tick must be lesser than, or equal to the maximum tick(443636) | 上限 tick 上溢。 | 「上限價格過高。」 |
| 6008 | TickAndSpacingNotMatch | tick % tick_spacing must be zero | 提交的 tick 不是資金池 tick_spacing 的整數倍。 | 「請將價格對齊至最近的有效刻度。」 |
| 6009 | InvalidTickArray | Invalid tick array account | 傳入的 tick-array 槽位 PDA 錯誤。 | 「內部錯誤:tick array 錯誤——請重新整理資金池資料。」 |
| 6010 | InvalidTickArrayBoundary | Invalid tick array boundary | tick-array 索引發生差一錯誤。 | 「內部錯誤:tick-array 邊界錯誤。」 |
| 6011 | SqrtPriceLimitOverflow | Square root price limit overflow | 呼叫者提供的 sqrt_price_limit 超出有效範圍。 | 「價格限制超出範圍。」 |
| 6012 | SqrtPriceX64 | sqrt_price_x64 out of range | 資金池的當前 sqrt 價格在 swap 過程中偏移超出範圍。 | 「請重試 swap。」 |
| 6013 | LiquiditySubValueErr | Liquidity sub delta L must be smaller than before | 減少流動性時發生內部不變量違規。 | 「內部錯誤:流動性計算異常。」 |
| 6014 | LiquidityAddValueErr | Liquidity add delta L must be greater, or equal to before | 增加流動性時發生內部不變量違規。 | 「內部錯誤:流動性計算異常。」 |
| 6015 | ForbidBothZeroForSupplyLiquidity | Both token amount must not be zero while supply liquidity | 增加流動性時 amount_0_max 和 amount_1_max 均為零。 | 「請至少提供一種 token 的金額。」 |
| 6016 | LiquidityInsufficient | Liquidity insufficient | 倉位的流動性不足以滿足提款需求。 | 「提款金額超過倉位的流動性。」 |
| 6017 | PriceSlippageCheck | Price slippage check | 執行價格未通過呼叫者的滑點保護檢查。 | 「價格超出你的滑點容忍範圍,請提高滑點設定或重試。」 |
| 6018 | TooLittleOutputReceived | Too little output received | SwapBaseInput:輸出金額低於 other_amount_threshold。 | 「滑點超限——未達到最小輸出金額。」 |
| 6019 | TooMuchInputPaid | Too much input paid | SwapBaseOutput:輸入金額超過 other_amount_threshold。 | 「滑點超限——超過最大輸入金額。」 |
| 6020 | ZeroAmountSpecified | Swap special amount can not be zero | swap 指令的 amount 為零。 | 「請輸入大於零的金額。」 |
| 6021 | InvalidInputPoolVault | Input pool vault is invalid | swap 的輸入 vault 帳戶與資金池記錄的 vault 不符。 | 「內部錯誤:輸入 vault 錯誤——請重新整理資金池資料。」 |
| 6022 | TooSmallInputOrOutputAmount | Swap input or output amount is too small | swap 計算結果四捨五入為零,通常是極小的零碎金額。 | 「金額過小,無法在此資金池進行 swap。」 |
| 6023 | NotEnoughTickArrayAccount | Not enough tick array account | swap 範圍所需的 tick-array 剩餘帳戶數量不足。 | 「內部錯誤:tick-array 不足——請重新整理資金池資料。」 |
| 6024 | InvalidFirstTickArrayAccount | Invalid first tick array account | 傳入的第一個 tick-array 帳戶未涵蓋當前 tick。 | 「內部錯誤:第一個 tick array 錯誤——請重新整理資金池資料。」 |
| 6025 | InvalidRewardIndex | Invalid reward index | reward_index 超出 [0, 2] 範圍。 | 不適用——管理員路徑。 |
| 6026 | FullRewardInfo | The init reward token reach to the max | 資金池已設定了最多(3 個)獎勵 mint。 | 不適用——管理員路徑。 |
| 6027 | RewardTokenAlreadyInUse | The init reward token already in use | 獎勵 mint 與現有的重複。 | 不適用——管理員路徑。 |
| 6028 | ExceptRewardMint | The reward tokens must contain one of pool vault mint except the last reward | 在第 2 個槽位之前,獎勵 mint 必須等於資金池其中一個 vault mint。 | 不適用——管理員路徑。 |
| 6029 | InvalidRewardInitParam | Invalid reward init param | 獎勵排放的開始/結束時間或每秒速率設定有誤。 | 不適用——管理員路徑。 |
| 6030 | InvalidRewardInputAccountNumber | Invalid collect reward input account number | 傳入 CollectReward 的剩餘帳戶數量有誤。 | 「內部錯誤:帳戶數量錯誤——請重新整理後再試。」 |
| 6031 | InvalidRewardPeriod | Invalid reward period | 獎勵排放期間無效(end <= start 或持續時間為零)。 | 不適用——管理員路徑。 |
| 6032 | NotApproveUpdateRewardEmissions | Modification of emissions is allowed within 72 hours from the end of the previous cycle | 管理員試圖在週期邊界前後 72 小時視窗以外修改排放設定。 | 不適用——管理員路徑。 |
| 6033 | UnInitializedRewardInfo | uninitialized reward info | 獎勵槽位尚未初始化但被引用。 | 不適用——管理員路徑。 |
| 6034 | NotSupportMint | Not support token_2022 mint extension | CLMM 遇到無法處理的 Token-2022 擴充功能。 | 「此 token 包含 Raydium CLMM 不支援的擴充功能。」 |
| 6035 | MissingTickArrayBitmapExtensionAccount | Missing tickarray bitmap extension account | swap 跨越了基礎 bitmap 未涵蓋的 tick 範圍,需要擴充 bitmap 帳戶。 | 「內部錯誤:缺少 tick-array 擴充——請重新整理資金池資料。」 |
| 6036 | InsufficientLiquidityForDirection | Insufficient liquidity for this direction | swap 方向上的流動性不足。 | 「此 swap 規模的流動性不足。」 |
| 6037 | MaxTokenOverflow | Max token overflow | 輸入/輸出金額超過 u64 上限。 | 「金額對此資金池而言過大。」 |
| 6038 | CalculateOverflow | Calculate overflow | 手續費/流動性算術溢位。 | 「金額對此資金池而言過大。」 |
| 6039 | TransferFeeCalculateNotMatch | TransferFee calculate not match | Token-2022 轉帳手續費的實際觀察金額與預期不符。 | 「Token 轉帳費用在交易過程中發生變動,請重試。」 |
| 6040 | OrderAlreadyFilled | Order already fully filled, cannot modify | IncreaseLimitOrder / DecreaseLimitOrder 被呼叫於未成交部分為零的訂單。 | 「此限價單已全部成交——請結算以領取輸出。」 |
| 6041 | InvalidOrderPhase | Invalid order phase | 試圖修改一個 FIFO 批次階段已不再符合該 tick 當前批次的訂單。 | 「無法在訂單的當前狀態執行此操作。」 |
| 6042 | InvalidLimitOrderAmount | Invalid limit order amount | 訂單金額在開倉/增加/減少時低於資金池最小值(或為零)。 | 「訂單規模低於資金池最小限制。」 |
| 6043 | OrderPhaseSaturated | Tick order phase saturated | 該 tick 上批次的 order_phase 計數器已達上限,在現有批次結算並輪換之前,無法在該 tick 繼續開單。 | 「此價格的活躍訂單過多,請嘗試鄰近的 tick 或等待訂單結算。」 |
| 6044 | InvalidDynamicFeeConfigParams | Invalid dynamic fee config params | CreateDynamicFeeConfig / UpdateDynamicFeeConfig 被拒絕;或 CreateCustomizablePool 在沒有有效設定的情況下啟用了動態手續費。 | 管理員路徑不適用;使用者路徑顯示「動態手續費設定無效」。 |
| 6045 | InvalidFeeOn | Invalid fee on which token (must be 0, 1, or 2) | CreateCustomizablePool 傳入的 collect_fee_on 值超出 {0, 1, 2} 範圍。 | 「內部錯誤:手續費模式無效。」 |
| 6046 | ZeroSqrtPrice | sqrt_price_x64 must be greater than 0 | CreateCustomizablePool(或其他接受自訂初始 sqrt 價格的路徑)以 sqrt_price_x64 == 0 被呼叫。 | 「初始價格必須大於零。」 |
| 6047 | ZeroLiquidity | liquidity must be greater than 0 | 提供流動性的路徑以 liquidity == 0 且無補償金額被呼叫。 | 「流動性金額必須大於零。」 |
| 6048 | MissingBaseFlag | base_flag is required when liquidity is zero | 以金額開倉的路徑計算出 liquidity == 0,且呼叫者未提供 base_flag 以區分哪一側為基礎資產。 | 「請提供非零的流動性,或指定哪個 token 為基礎資產。」 |
| 6049 | MissingMintAccount | Mint account is required but not provided | 一個具備 Token-2022 感知能力的路徑被呼叫時,缺少用於驗證擴充功能及轉帳手續費所需的輸入/輸出 mint 帳戶。 | 「內部錯誤:缺少 mint 帳戶——請重新整理資金池資料。」 |
| 6050 | MissingTokenProgram2022 | Token-2022 program is required but not provided | 同上,缺少 SPL-Token-2022 程式帳戶。 | 「內部錯誤:缺少 Token-2022 程式——請重新整理後再試。」 |
關於重新編號的說明。 此版本中,CLMM產生來源:github.com/raydium-io/raydium-clmm — error.rs。ErrorCode列舉已重新編號:五個舊版變體(LOK、ZeroMintAmount、InvalidLiquidity、TransactionTooOld、InvalidRewardDesiredAmount)及數個拼字錯誤(Liquitity、enought、emissiones)已被移除或修正,並新增了十一個新變體。由於 Anchor 按原始碼順序編號錯誤,6000及之後的所有代碼相對於預發布版本均已偏移。已將數字代碼硬編碼到舊版本的客戶端需要重新對應。
AMM v4、Farm v3 / v5 / v6、LaunchLab 錯誤
這些程式的說明文件位於各自的章節(請參閱products/amm-v4/instructions、products/farm-staking/instructions、products/launchlab/instructions)。由於這些程式混用了 Anchor 與原生 Solana 的錯誤介面,其錯誤表格放置於指令參考旁,而非此處。以下代碼由各章節保留:
| 程式 | 代碼範圍(僅限 Anchor) | 參考 |
|---|---|---|
| AMM v4 | 自訂 u32 代碼,非 Anchor 風格 | products/amm-v4/instructions |
| Farm v3 / v5 | 自訂 u32 代碼 | products/farm-staking/instructions |
| Farm v6 | 6000+(Anchor) | products/farm-staking/instructions |
| LaunchLab | 6000+(Anchor) | products/launchlab/instructions |
將 SDK 錯誤對應至程式錯誤
官方 TypeScript SDK 會將鏈上錯誤封裝成SendTransactionError,對於 Anchor 程式則封裝成 AnchorError:
Error Number: (\d+) 這個模式在所有 Anchor 版本中保持穩定,可安全使用於匹配。
重新產生這些表格
當程式升級並新增錯誤時,請從原始碼重新擷取:reference/changelog,讓正在升級 SDK 的整合者知道需要更新其錯誤處理邏輯。
來源:


