Skip to main content
These are the AMM program errors an integrator can hit on the swap path of the Lend AMM. Codes are the Anchor custom-error numbers (the program’s error enum starts at 6000); the name is the ErrorCodes variant. The on-chain message string is the SCREAMING_SNAKE form of the name (e.g. DEX_NOT_ENOUGH_AMOUNT_OUT).

Slippage

These are the expected failures when the market moves between quote and execution. No funds move. Re-quote with a fresh snapshot and retry.

Size and dust limits

Reserves and utilization

Pool state

Center price (external-oracle pools)

Accounts (CPI integrators)

Simulation sentinel (not a real failure)

These are intentional: the off-chain quote-by-simulation path (see TypeScript: exact on-chain quoting via simulation). A real swap must never use the ADDRESS_DEAD recipient.

Reading the code from a failed transaction

  • TypeScript: Anchor throws an AnchorError; read err.error.errorCode.number (e.g. 6024) and err.error.errorMessage. Raw logs contain Program ... failed: custom program error: 0x1798, which is the code in hex: 0x1798 = 6040, 6024 = 0x1788.
  • CPI: the inner error propagates to your program. Wrap the dex::cpi::* call in a match and map the failure to your own error if you want a cleaner message; otherwise let it bubble up and the transaction fails with the error code above.