What the error means
Error Code: BuyNotEnoughSolToCoverRent. Error Number: 6040. Error Message: Buy: Not enough SOL to cover for rent exemption. / Error Code: BuyNotEnoughSolToCoverFees. Error Number: 6041.
Your wallet has enough for the buy itself but not for the extra costs: rent for new accounts (6040) or the trading fees (6041).
| Where it comes from | pump.fun bonding curve program |
| Code | 6040 (0x1798) and 6041 (0x1799) |
How to fix it
- Keep a buffer of SOL beyond the buy amount for fees, rent and priority fees.
- Reduce the buy amount slightly.
- Close empty token accounts to recover rent if your wallet is low, see reclaim SOL rent.
If that is not it
- If the error is 6002, the problem is slippage, not balance.
More fixes: how to decode any Solana error code and why Solana transactions fail.
Source
Error text and code from pump.fun program IDL (pump-fun/pump-public-docs, idl/pump.json), read on 24 October 2026.

