Program

Errors

All twenty-three errors of the kodama program with code, name and message, the instructions that raise each and under what condition, and the Anchor, Raydium and Token errors a caller meets beside them.

How an error reaches you

A refused instruction fails its whole transaction. The program's own errors are custom program errors numbered from 6000, shown in logs and simulations in hex: 6000 is 0x1770. The name and message come from the IDL at backend/programs/kodama/idl.json, and IDL.errors in backend/src/program/index.ts holds the same list.

LaunchLab and CPMM are Anchor programs too and number their own errors from 6000. A code belongs to the first program the logs show failing, never to the program that called it. Read the first Program … failed line before naming an error.

errors.ts
import { IDL, PROGRAM_ID } from './backend/src/program/index.js'

/** The kodama error for a custom code raised by the kodama program, or null for another program's. */
export function kodamaError(failedProgram: string, code: number) {
  if (failedProgram !== PROGRAM_ID.toBase58()) return null
  return IDL.errors.find((error) => error.code === code) ?? null
}

The path is written from the repo's root. How the API reports these errors is on API errors.

The program's errors

CodeHexNameMessage
60000x1770InvalidAccountThe supplied account does not belong to this tree.
60010x1771InvalidLaunchLabAccountThe LaunchLab account is invalid.
60020x1772InvalidCpmmAccountThe CPMM account is invalid.
60030x1773InvalidFeeKeyThe Fee Key account is invalid.
60040x1774InvalidConfigThe grove configuration is invalid.
60050x1775InvalidAmountThe amount must be greater than zero.
60060x1776MathOverflowAn amount exceeded the supported range.
60070x1777NotAdminOnly the grove administrator can do this.
60080x1778NotAKodamaYou are not a kodama of this tree.
60090x1779AlreadyWateredTodayYou already watered this tree today.
60100x177aNoCoinsCountingTodayYou have no coins counting today.
60110x177bNothingToPickThere is no fruit ready to pick.
60120x177cAmountAboveCoinsInTreeThe amount is above your coins in the tree.
60130x177dNotThePlanterYou are not this tree's planter.
60140x177eNothingToClaimThere is no planter share ready to claim.
60150x177fNothingToClaimEchoThere is no echo ready to claim.
60160x1780DayNeedsCloseClose the previous day before this action.
60170x1781DayNotEndedThe tree's day has not ended yet.
60180x1782DayNeedsSettlementSettle the previous watered day before this action.
60190x1783InvalidDayThis is not the day this kodama watered.
60200x1784AlreadyPlantedThis coin has already been planted.
60210x1785NotPlantedThis coin has not been planted yet.
60220x1786InsufficientFundsThe purse does not have enough spendable SOL.

What raises each

InvalidAccount

  1. An account is in the wrong place, is missing, or is not what its place requires.
Raised byWhen
prepare_treecpmm_config is not owned by CPMM or is not a fee tier account.
plantfirst_buy is above 0 and planter_quote is left out.
echoed_buyvenue is 1 and one of the seven CPMM accounts is left out. echo_record is not the Kodama address for echo_owner. That address holds a Kodama of another tree or owner, or holds anything else than an empty System account. The LaunchLab pool, the CPMM pool or the tier is not owned by its program or is not that kind of account.
harvestThe coin has graduated and one of the CPMM or Fee Key accounts is left out. Liquidity fees are being collected and lp_lock_program, token_2022_program or memo_program is left out or wrong. A token account the instruction reads is not a Token program account of the expected mint and owner. The LaunchLab pool, the CPMM pool, the tier or the LP-Lock position is not owned by its program or is not that kind of account. A remaining account is not writable, is passed twice, is not owned by the program, is a Kodama of another tree, or is not at its own Kodama address.

InvalidLaunchLabAccount

  1. A LaunchLab account does not pass the program's checks.
Raised byWhen
prepare_treeThe PlatformConfig LaunchLab created does not name the purse in every seat, with a fee rate of fee_ppm, a creator fee of 0, all liquidity locked to the platform, and the Grove's tier.
plantglobal_config is not a LaunchLab GlobalConfig, is not of curve type 0, or does not quote in wrapped SOL, or platform_config fails the PlatformConfig check.
echoed_buy, harvestThe LaunchLab pool's GlobalConfig, PlatformConfig, mint, quote mint or creator differ from the tree's, or the pool does not carry the settings every Kodama coin is created with. The PlatformConfig fails its check.
echoed_buyvenue is 0 and the curve is no longer trading. The curve vaults are not the pool's.

InvalidCpmmAccount

  1. A CPMM account does not pass the program's checks, or CPMM was asked for at the wrong time.
Raised byWhen
prepare_tree, echoed_buy, harvestThe tier's index is not the Grove's cpmm_index, or its trade fee, creator fee or creator fee share are not 2,000, 19,000 and 0.
echoed_buyvenue is neither 0 nor 1. venue is 1 and the coin has not graduated. cpmm_config is not the Grove's. The pool is not the tier's own pool for the coin and wrapped SOL with the purse as creator and its creator fee charged in SOL. The pool is not open yet or has swaps off. The authority, a vault or the observation account is not the pool's.
harvestcollect_liquidity is true and the coin has not graduated. cpmm_config is not the Grove's. The pool fails the check above. The authority, a vault, the LP mint or the creator fee share address is not the pool's.

InvalidFeeKey

  1. Raised only by harvest, after graduation.
Raised byWhen
harvestfee_key_token is not the purse's associated token account for fee_key_mint, or does not hold exactly 1. lock_authority is not LP-Lock's authority. locked_lp_vault is not that authority's account for the LP mint. locked_liquidity is not the LP-Lock position of fee_key_mint, or its pool, key, LP mint or locker are not this pool's migration lock. The Tree already has a pool and a Fee Key written and these are others.

InvalidConfig

  1. A text argument breaks a rule.
Raised byWhen
prepare_treename is not Kodama, or web or img is longer than 256 bytes.
plantname is empty or longer than 32 bytes, symbol is empty or longer than 10 bytes, or uri is longer than 200 bytes.

InvalidAmount

Raised byWhen
move_in, move_outamount is 0.
echoed_buyamount_in is 0.

MathOverflow

  1. A sum, difference or product left the range of its type. Every instruction that does arithmetic can raise it: prepare_tree, echoed_buy, move_in, move_out, water, harvest, close_day, settle, pick, claim_planter and claim_echo.

NotAKodama

Raised byWhen
waterThe wallet's Kodama account has no coins in the tree.

A wallet that never moved in has no Kodama account at all, and meets Anchor's AccountNotInitialized instead.

AlreadyWateredToday

Raised byWhen
waterThe kodama's last_watered_day is today. This stays true after it moves coins out the same day.

NoCoinsCountingToday

Raised byWhen
waterThe kodama has coins in the tree and all of them were moved in today. Coins moved in today count from tomorrow.

NothingToPick

Raised byWhen
pickThe kodama's fruit_ready is 0 after any due settlement.

AmountAboveCoinsInTree

Raised byWhen
move_outamount is above the kodama's coins_in_tree.

NotThePlanter

Raised byWhen
plant, claim_planterThe signer is not the tree's planter.

NothingToClaim

Raised byWhen
claim_planterThe tree's planter_waiting is 0.

NothingToClaimEcho

Raised byWhen
claim_echoThe kodama's echo_payable is 0 after the tree's echo reserve has been applied to its echo_pending. Echo share that no harvest has backed yet is not claimable.

DayNeedsClose

Raised byWhen
echoed_buy, move_in, water, settle, pick, move_out, claim_planter, claim_echoThe tree's day_index is not the current day. Run harvest and close_day for the tree first, as Fee routing and cranks tells.

DayNotEnded

Raised byWhen
close_dayThe tree's day_index is already the current day.

DayNeedsSettlement

Raised byWhen
move_in, water, pick, move_outThe kodama's latest watering is in a closed day and not settled, and the optional day account was left out. Pass the Day for the kodama's last_watered_day, or run settle first.

InvalidDay

Raised byWhen
move_in, water, pick, move_out, settleThe Day account passed for settlement is another tree's, is not the kodama's last_watered_day, or is not closed yet.
harvestThe tree's day_index is ahead of the current day.

AlreadyPlanted

Raised byWhen
plantThe tree's launchlab_pool is already set.

NotPlanted

Raised byWhen
echoed_buy, move_in, water, harvest, settle, pick, move_out, claim_planter, claim_echoThe tree was prepared and its coin has not been planted: launchlab_pool is all zeros.

InsufficientFunds

Raised byWhen
pick, claim_planter, claim_echoThe purse holds less than the amount above the rent of an empty account.

Anchor errors

Anchor checks every account against the instruction's constraints before the handler runs. These are the checks the program declares and the Anchor error each raises.

CodeNameWhen, in this program
2001ConstraintHasOneA Tree is passed with a grove, mint, coin_vault, purse or platform_config other than the one it records. A Kodama is passed with another tree, or by a signer who is not its owner. In settle, the Day is another tree's.
2004ConstraintOwnerIn close_day, the day address is no longer owned by the System program.
2006ConstraintSeedsA grove, burner, tree, purse, kodama, day or event_authority is not at the address its seeds give.
2007ConstraintExecutablelaunchlab_program or metadata_program is not an executable program.
2012ConstraintAddressAn account with one possible address is another: the wrapped SOL mint, a Raydium program, authority, pool or vault, the metadata address, the tree's coin_vault, launchlab_pool, platform_config or mint, the Grove's global_config or cpmm_config, or the purse's token accounts.
2014ConstraintTokenMintowner_coin, coin_vault, buyer_base, buyer_quote or planter_quote is a token account of another mint.
2015ConstraintTokenOwnerOne of the same token accounts belongs to another owner.
3010AccountNotSignerA required signer did not sign.
3011AccountNotSystemOwnedThe purse or burner passed is not owned by the System program.
3012AccountNotInitializedAn account the instruction reads does not exist yet: a Tree before prepare_tree, a Kodama before its first move_in, a Day that was never created, or a token account.

Creating an account that already exists fails in the System program, not in Anchor. That is what a second prepare_tree for the same mint meets.

Errors of the programs it calls

The program calls LaunchLab, CPMM, LP-Lock and the Token program, and their errors pass through unchanged, raised by that program. The API names these when it reports a refused transaction:

ProgramCodeNameWhat it means
LaunchLab6004ExceededSlippageThe buy would return fewer coins than minimum_out: the price moved. Build the trade again, or allow more slippage.
LaunchLab6005PoolFundingThe coin changed phase. Build the trade again.
LaunchLab6006PoolMigratedThe coin changed phase. Build the trade again.
Token0NotRentExemptThe account is not rent-exempt.
Token1InsufficientFundsNot enough tokens in the account: fewer coins in owner_coin than move_in moves, or less wrapped SOL than a buy spends.
Token2InvalidMintThe mint is invalid.
Token3MintMismatchThe account belongs to another mint.
Token4OwnerMismatchThe account belongs to another owner.
Token17AccountFrozenThe token account is frozen.
Token18MintDecimalsMismatchThe decimals do not match the mint.

LaunchLab's 6004 and the program's own 6004, InvalidConfig, are different errors. The program that failed tells them apart.