Tx Doctor / Solana error library / Account not empty — cannot close
Solana error: Account not empty — cannot close (0xb)
A close-account instruction ran on a token account that still holds tokens, which the program refuses so nothing is burned by accident.
Why it happens
- Only accounts with exactly zero tokens can be closed. Dust amounts (a few decimal places left over after a swap) keep the account open.
- Users often see this when sweeping wallets or cleaning up small positions.
How to fix it
- Transfer the remaining dust out (even to a burn address the token supports), or swap it, then close the account.
- If the leftover is worthless, just leave the account open — it costs nothing once rent-exempt, and closing is optional.
- Developers: pair close-account with a preceding transfer-all instruction in the same transaction.
What it looks like in the logs
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: custom program error: 0xb RPC simulation: Transaction simulation failed: Error processing Instruction: custom program error: 0xb Wallet UI: "Transaction failed" — custom program error 0xb (11)
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.
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