Tx Doctor / Solana error library / Not enough tokens to sell
Solana error: Not enough tokens to sell (Pump.fun 6023)
You asked to sell more tokens than the curve can absorb, or more than you hold in the account passed in.
Why it happens
- The sell must draw from your token account. A balance smaller than the amount — after fees or a prior partial sell — fails here.
- Very large sells against thin curves exhaust the SOL side and cannot be absorbed in one instruction.
- It also fires when the wrong token account is passed (a different mint's ATA).
How to fix it
- Check your actual token balance in that account and sell no more than it holds.
- Split a large exit into several sells so the curve can absorb each one.
- Confirm you passed the ATA for this specific mint, not a lookalike token account.
What it looks like in the logs
Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P failed: custom program error: 0x1787 RPC simulation: Transaction simulation failed: Error processing Instruction: custom program error: 0x1787 Wallet UI: "Transaction failed" — custom program error 0x1787 (6023)
One failure, three places it shows up: the raw transaction log, the RPC simulation error, and the wallet's short message. Match on the code, never on the wording.
The same number means something else on another program
Anchor assigns custom error codes by enum order starting at 6000, so this number is local to this program. The rows below show what the very same number means on the other programs.
| Program | 0x1787 = 6023 |
|---|---|
| Jupiter | Invalid authority |
| Orca | Invalid tick array sequence |
| Raydium CLMM | Not enough tick array accounts |
What this means for your funds
Solana transactions are atomic: if any instruction fails, every state change in that transaction is reverted, so token balances end exactly where they started. The network fee is still charged, because validators did the work of executing and rejecting it. A failed transaction never moves your tokens to someone else.
Seeing this error right now? Paste your transaction signature and get the exact instruction, program and code that failed.
Diagnose my transaction