As easy as crypto trading and exchanging has become for regular users on the front-end, coding these massive exchanges and implementing contracts is still a mammoth task if you’re a developer.
In this article, we’re looking at the “fail with error transferhelper: transfer_from_failed” error, its causes and what you can do to fix the problem.
What causes this error?
The error is mainly caused after you purchase a fake or scam token as these tokens are available for purchase, but when you exchange or sell them, the contract code rejects the token, restricting your transfer. If a token you’re buying only has purchases and no sales, there’s a good chance that it’s a scam, and you won’t be able to sell it further.
Additionally, there’s also a chance that this error might just be a bug in the contract’s code.
Also read: Does Google index NFT domains?
How to fix this?
Here are three solutions you can try out to fix the error.
Check the contract pair
The main thing you have to keep in mind during swapping tokens back and forth is that you need to approve the token and contract pair, not the router itself. This means you need to have the addresses for your contract and your swapper ready for approval instead of using the router.

These addresses can differ depending on your contract, so be sure to cross-check with your contract’s documentation before proceeding.
Disable the liquify feature
If you’re using Pancake as your contract, you can also get around the error by disabling the setSwapAndLiquifyEnabled feature. Alternatively, you can use the first version of PancakeSwap, which doesn’t have the feature, instead of the latest version two.
Change the last digit of your swap
If you’re a user seeing the error on an application endpoint, you can try adding a ‘1’ to the end of your swap value to see if you can circumvent the error. This means that if you’re swapping 100 tokens, try swapping 101 to see if the transaction goes through.
Connect your contract to web3
Last but not least, you can also try connecting your token’s contact to web3. You can do so by visiting BscScan and looking for the token you’ll be supporting. Once you’re on the token page, you’ll see the Write Contract tab, which has the Connect to Web3 button.

Connect your contract to web3 using a wallet of your choice, and the error should’ve been resolved.
Also read: What does the green circle mean on Instagram?