Skip to main content
iCrypto

Crypto news, costs and deadlines

TRANSFER_FROM_FAILED on a DEX swap: how to fix it

What does TRANSFER_FROM_FAILED mean on a DEX swap? The router could not pull your input token; check allowance, balance and token rules before retrying.

iCrypto Editorial4 min read

TRANSFER_FROM_FAILED on a DEX swap: how to fix it

TRANSFER_FROM_FAILED on a DEX swap means the router tried to move your input token from your wallet and the token contract refused. In V2-style routers, TransferHelper.safeTransferFrom makes that attempt and reverts if the token’s transferFrom call fails or returns false.

  • You will learn why the swap failed and whether your input tokens moved.
  • You will need the failed transaction hash and access to a block explorer.

What the revert means and what happens to your tokens

The failed swap is reverted, so your input tokens stay in your wallet, but the gas used for the transaction is still charged. A revert undoes the transaction’s state changes; it does not refund the network fee.

Uniswap V2-style routers, including the Fraxswap Router, pull your input tokens with TransferHelper.safeTransferFrom. The router needs the token contract to accept that transfer from your wallet before it can perform the swap. If the call fails, the router stops and the whole transaction reverts.

The most common reason is that the router’s allowance is below the amount you tried to swap. An allowance is the amount of a token you have authorized a specific router to spend. It may be too low because approval was skipped, set for a smaller amount, or later revoked.

A balance shortfall can cause the same error. This can happen if you chose “Max” on a rebasing or interest-bearing token: its balance may shift by a few wei between the quote and execution, leaving the amount entered just above what the token will transfer. Some fee-taking tokens also apply transfer rules that affect the amount available.

Less often, the token itself blocks transfers. A pause, blacklist, or trading restriction can make transferFrom fail even when the wallet has enough tokens and has approved the router. In that case, changing the allowance alone will not clear the restriction.

How to find and fix the failure

Use the failed transaction hash to identify the token and amount involved. Open the transaction in Etherscan or another block explorer and look at its details and revert information. The exact display varies, but the transaction record can help you confirm which swap failed and which token was being transferred.

Compare the amount shown with your token balance and the allowance granted to the router. If the swap was on Fraxswap, the Fraxswap Router must have an allowance for that input token; an approval for a different router does not apply. You can review or set that allowance in your wallet or the swap interface.

Approve at least the amount you plan to swap if the allowance is too low. If your balance is short, lower the input amount. When using “Max” with a rebasing or interest-bearing token, leave a small amount behind to account for a balance shift before execution. This gives the router an amount the token can actually transfer.

Then retry the swap. If the allowance and balance both cover the amount but the token still rejects the transfer, check whether the token has paused transfers or restricts trading. A restricted token may keep failing until its rules allow the transfer.

Say you try to swap 100 tokens, but the router is approved to spend only 80. The router requests the full 100 through transferFrom, the token refuses, and the swap reverts. Your 100 tokens remain in your wallet; you lose the gas used. Approving 100 or reducing the swap to 80 addresses the mismatch. This is an illustrative case of how checking the transaction details can point to a specific fix.

Related

Why does my approval succeed but the swap still fail?

An approval can succeed while the swap fails if it granted too little allowance, or if it was for a different router or token. Compare the approved spender and amount with the router and input shown for the failed swap. If both match, check your balance and whether the token restricts transfers.

Do I get gas back when a swap fails?

No. The revert returns the transaction’s state changes, including the attempted token movement, but the network still charges for the gas used. You can verify the failed status and fee in the transaction record.

Once the transaction shows Success and the output tokens arrive, the swap has gone through. Check the transaction again after retrying; it confirms whether your change resolved the transfer failure.