Cryptocurrency News

How to Fix “Swap Failed” on Uniswap

By August 27, 2024 No Comments

If you’re encountering a “Swap Failed” error on Uniswap, there are several reasons this might happen. The most common reasons are your slippage settings and not enough funds.

In this article, we will go over the steps that you can take that are likely to solve 99.99% of “Swap Failed” issues on Uniswap.

Key Takeaways

  • Adjust slippage tolerance settings to ensure successful trade execution and minimize losses
  • Verify wallet balance and be sure you have enough ETH or another chain crypto for gas fees and a sufficient token amount for the swap
  • Extend transaction deadlines beyond the default 30 minutes to accommodate network fluctuations
  • Monitor network congestion to set appropriate deadlines and fees for timely transactions
  • Retry failed transactions after checking and adjusting gas fee and deadline settings

Adjusting Slippage Tolerance Settings

Uniswap – which uses the UNI token for governance and fee payments – is the largest and most used Decentralized Exchanges (DEXes) in crypto, and one of the necessary aspects of navigating Uniswap transactions is managing slippage tolerance settings. These parameters directly influence the success of your swaps. 

The default slippage tolerance on Uniswap is set at 0.5% (and 0.1% for Uniswap V3), which might be too low to be sufficient for tokens with transaction fees.

To avoid failed swaps, try adjusting your slippage tolerance settings. You can adjust the slippage tolerance by clicking the gearbox icon on the Uniswap interface and selecting the “Custom” option. Here, you can input a custom maximum slippage percentage.

Adjusting slippage on Uniswap to avoid Swap Failed issue

For tokens with significant sell fees, you might need to increase the slippage tolerance to at least 1%, and in volatile markets, settings closer to 10%-12% may be necessary. Increase the slippage tolerance incrementally in small percentages to mitigate risks while avoiding excessive price deviations. For example, if 0.5% is too low, don’t immediately go 5%. Start increasing it gradually, first to 1%, then 1.5% and so on. 

This approach helps you get a successful trade execution while minimizing potential losses.

Insufficient Tokens or ETH

If your slippage tolerance settings are in order, the next step is to make sure you have sufficient tokens and ETH (assuming you’re using Ethereum blockchain) to execute the transaction. Check your wallet balance to ensure you have enough ETH to cover the transaction fees.

Of course, if you’re using a different chain, you may need to pay gas fees in a different cryptocurrency. For example, for the BNB Chain you need BNB, for Avalanche you need AVAX, and so on.

Each transaction on Uniswap requires enough crypto to cover gas fees, which may fluctuate based on network congestion. Always verify the current gas prices before initiating a swap to avoid timeouts and enhance transaction success.

Also, confirm that you have the required amount of tokens you intend to swap. Attempting to swap more than your available balance will, of course, give back an error.

If trading a token that has a fee on transfer, make sure to account for that fee in your swap calculation to avoid trading an insufficient amount. Keeping an eye on both token balances and gas fee reserves is necessary, as a lack of either can halt a transaction and result in a swap failure.

Transaction Timeout Issues

Transaction timeout issues on Uniswap can be frustrating, especially when you’re eager to complete a swap. A timeout occurs if the process exceeds 30 minutes, and this will result in an automatic failure of the swap.

To mitigate this, you should adjust the transaction deadline settings to allow for longer processing times during high network congestion.

Here are key points to consider:

  • Timeout duration: Uniswap transactions automatically fail if they take more than 30 minutes to complete.
  • Adjust transaction deadline: Increase the transaction deadline settings to give your transaction more time to process.
  • Increase gas price: Low network fee settings can cause delays. If you increase the gas price, it may help execute transactions promptly.
  • Monitor network congestion: Keep an eye on network congestion during peak times to time your transactions better and avoid timeouts.
  • Retry after adjustments: If a transaction fails due to timeout, retry after checking and adjusting your gas fee settings.

Other Uniswap Error Types

The K error indicates a Uniswap liquidity pool imbalance, i.e., you attempted a trade which, if executed, would leave the liquidity pool with fewer reserves than expected by the Uniswap protocol. If that happens, the transaction is automatically reverted and won’t go through. 

The INSUFFICIENT_A_AMOUNT and INSUFFICIENT_B_AMOUNT errors occur when there are insufficient input tokens or output amounts for the swap. The TRANSFER_FAILED error typically indicates issues with token contracts or when the transfer function is disabled for the token being traded.

Other errors include EXPIRED, which occurs when transactions take longer than the designated 30-minute deadline, often due to low network fees or high congestion.

The bottom line

To fix a “Swap Failed” error on Uniswap, you should first check your wallet balance to ensure you have enough tokens and transaction fees. Then, adjust your slippage tolerance, especially for volatile tokens, to at least 1% or more if necessary. These two alone should fix the issue 99% of the time. 

Extend the transaction deadline beyond the default 30 minutes and consider increasing the gas price to expedite processing. Lastly, make sure that your token contract approvals are in place. To avoid paying too much fees, you can consider using cryptocurrencies that are cheap to transfer.

FAQs

Why is my swap failing on Uniswap?

A swap on Uniswap may fail due to several reasons. The most common ones include incorrect slippage tolerance settings, insufficient funds to cover the transaction, or network congestion. Another common cause is an imbalance in the liquidity pool for the tokens you’re trying to trade, which can trigger the transaction to be reverted.

What happens if a swap fails?

If a swap fails on Uniswap, the transaction will not go through, and your tokens will remain in your wallet. The network will still deduct a small gas fee for attempting the transaction, but the swap itself will not be executed, meaning no tokens are transferred or exchanged.

How to fix slippage in Uniswap?

To fix slippage issues in Uniswap, you can adjust the slippage tolerance settings in the swap interface. You can do this by clicking the gearbox icon and selecting “Custom” to input a new slippage percentage. If your transaction fails due to slippage, gradually increase the slippage tolerance from the default 0.5% (or 0.1% in Uniswap V3) to a higher percentage until the transaction succeeds. Be cautious not to set it too high to avoid significant price deviations.