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; readerr.error.errorCode.number(e.g.6024) anderr.error.errorMessage. Raw logs containProgram ... 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 amatchand 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.
