A failed swap that still charged you gas feels deeply unfair. It's the second most-common beginner frustration after slippage — and once you know the causes, it's largely avoidable.
Why a failure still costs gas (on Ethereum)
When you submit a transaction, validators do the work of attempting it. If conditions aren't met it reverts — nothing trades — but the work was still done, so the gas is consumed. (On Solana, failed transactions are far cheaper, so this stings much less there.)
The usual causes
- Slippage too low. The price moved past your tolerance before settlement, so the contract refused the trade. The most common cause — nudge tolerance up slightly.
- "Insufficient output amount." The same thing in different words: the trade would have delivered less than your minimum received, so it reverted to protect you.
- Deadline exceeded. Swaps include a time limit; if the network was congested and your transaction sat too long, it expires.
- Gas too low. A priority fee set too low leaves the transaction stuck until it drops out or fails.
- Liquidity moved. In a thin or fast pool, the liquidity you quoted against can change before you settle.
How to prevent it
- Set slippage tolerance to match the pair — not too tight on volatile tokens.
- Don't under-set gas when the network is busy; let the wallet's estimate guide you.
- For volatile or thin tokens, trade smaller so you're less exposed to mid-flight moves.
- If it fails, read the error — it usually names the cause directly.
A failed transaction is annoying but harmless to your funds: nothing traded, and only the gas was spent. The next lesson covers the related case where a transaction neither fails nor succeeds — it just hangs.
≡Key terms
Revert — When a transaction's conditions aren't met and it undoes itself.
Insufficient output amount — The error when a trade would deliver less than your minimum.
Deadline — A time limit after which a pending swap expires.
Priority fee — The tip that determines how quickly your transaction is picked up.
!Common mistakes
- Resubmitting the same trade unchanged after a slippage failure, getting the same result.
- Setting gas too low during congestion, then wondering why nothing happens.
- Trading a volatile token at a tight tolerance and large size — almost designed to fail.