How to read a Solana "custom program error: 0x..."
Turn a hex code like 0x1771 into a named error: convert to decimal, find which program raised it, and look it up in that program's error list.
· 1 min read
custom program error: 0x1771 is about as unhelpful as an error gets. It has three parts you need to work out: which program, which number, and what that number means to that program.
Step 1: find the program
The line looks like Program <address> failed: custom program error: 0x1771. The address is the program that refused. If several programs report failure, the first failed line is the root cause; the ones after it are callers passing the error up.
Step 2: convert hex to decimal
0x1771 is hexadecimal. In decimal it is 6001. Any programmer's calculator will convert it.
Step 3: read the number
- 6000 and up: an error defined by that program. Look it up in its IDL or source. On Jupiter, 6001 is
SlippageToleranceExceeded. On Meteora DAMM v2, 6002 isExceededSlippage. The same number means different things in different programs. - 100 to 5999 in an Anchor program: a framework error shared by all Anchor programs, such as 2006
ConstraintSeedsor 3012AccountNotInitialized. - Small numbers (0, 1, 2...) usually come from older, non-Anchor programs like SPL Token, where 1 is
InsufficientFunds.
Where to look it up
Many Anchor programs publish their IDL on chain, and explorers show it on the program's page. Otherwise the program's open-source repository has an error.rs file. If you can't find it, the honest answer is "unknown": a guessed meaning is worse than none.
Rektopsy follows exactly this order: the program's own error log, runtime errors, a table of known programs, the program's on-chain IDL, and otherwise "unknown". It never guesses.
Quick answers
What is 0x1771 on Solana?
Hex for 6001. On Jupiter's aggregator program that is SlippageToleranceExceeded; on another program it could mean something else.
What are Anchor error codes 2000 to 5999?
Framework errors shared by every Anchor program, such as constraint failures (2000s) and account errors (3000s, e.g. 3012 AccountNotInitialized).
Why does the same error code mean different things?
Custom error codes are defined by each program. Only the program that raised the error can tell you what its number means.