Home » Finance » Cryptocurrency » How to Fix “Undefined” Error on PancakeSwap

How to Fix “Undefined” Error on PancakeSwap

Are you getting an “Undefined” error when you’re swapping tokens on PancakeSwap?

Here’s the full error message, “The transaction cannot succeed due to error: undefined”.

This error happens when you’re trying to buy or sell tokens on PancakeSwap.

Recently, PancakeSwap is taking a long time to show your token balance as well.

This is due to higher traffic on their exchange.

If you’re waiting for too long, try refreshing the page or closing and re-opening it.

In this guide, you’ll learn what does the “Undefined” error means on PancakeSwap.

You’ll also learn how to fix the “Undefined” error so that you can buy or sell tokens.

What does “Undefined” mean on PancakeSwap?

“Undefined” means that your transaction has failed.

The error occurred because you didn’t modify the number of tokens that you want to sell or buy.

If you didn’t modify the number of tokens you want to sell or buy, your transaction might fail.

This is because the system is unable to compute how many tokens you’re buying or selling.

This has to do with the estimate of tokens.

If you’re trying to buy a token using BNB or Ethereum, the estimate will be at the bottom field.

On the other hand, if you’re trying to sell a token for BNB or Ethereum, the estimate will be at the top field.

The error is caused because the estimated number (in brackets) is on the token’s field instead of the BNB or Ethereum field.

How to Fix “Undefined” Error on PancakeSwap

To fix “Undefined” error on PancakeSwap, you need to modify the number of tokens that you’re buying or selling so that the BNB or Ethereum field is estimated.

After you’ve modified it, your transaction will be successful.

Typically, whenever you’re buying a token, you’d normally specify the number of BNB or Ethereum that you want to swap it for.

For example, if you have 0.2 BNB and you want to swap it all for Bonfire, you’d input “0.2” on the BNB field.

When you do that, the number of Bonfire that you’re going to receive will be estimated.

As a result, the transaction will fail.

To fix this, you need to make sure that the BNB or Ethereum that you’re swapping is estimated instead of the token that you want to buy or sell.

If you’re buying a token, the estimated field needs to be at the top.

On the other hand, if you’re selling a token, the estimated field needs to be at the bottom.

Here’s how to fix “Undefined” on PancakeSwap:

Step #1: Change the last number of the token

Firstly, open Trust Wallet, tap on “Browser” and open PancakeSwap.

Once you’re on PancakeSwap, connect to Trust Wallet if you haven’t already.

Next, paste the address of the token that you’re trying to buy on the bottom field.

If you’re trying to sell, paste the address of the token on the top field instead.

When buying, input the number of BNB/Ethereum that you want to swap for the token.

For example, if you want to swap 0.1 BNB for SAFEMOON, input “0.1” on the top field (BNB).

The estimated number will then be at the bottom field (SAFEMOON).

Typically, you’d specify the number of BNB that you want to swap for a token (e.g. SAFEMOON).

After that, the number of tokens that you’re going to receive will be estimated.

However, the number of tokens cannot be estimated as it’s causing the “Undefined” error.

Instead, you need the BNB or Ethereum field to be estimated.

To do that, change the last number of the token that you’re trying to buy or sell.

For example, if you’re buying “7000000” SAFEMOON, change it to “7000001”.

After you’ve changed the last number of the token, the estimated field will now be at the top.

In other words, the BNB or Ethereum field is now estimated instead of the token.

This will allow your transaction to succeed.

Step #2: Increase your slippage tolerance

The next step is to increase your slippage tolerance.

Some tokens charge a fee, which means that there will be a large price difference.

For example, SAFEMOON charges a 10% transaction fee on each sale.

If your slippage tolerance is too low, your transaction will fail because of the 10% fee.

To fix this, you need to increase your slippage tolerance.

To do so, tap on the Settings icon on PancakeSwap.

After you’ve tapped on the Settings icon, the Settings pop-up will open.

On the Settings pop-up, you’ll see a “Slippage tolerance” header as well as three options.

Under the options, you’ll see a percentage field.

On the percentage field, change the number to “12”.

Alternatively, you can start with a 1% slippage tolerance and work your way up until your transaction succeeds.

This method will prevent you from losing a large portion of your funds.

After you’ve changed the last number of the token to “1” and increase your slippage tolerance, your transaction should succeed!

Conclusion

In the future, if you’re looking to buy or sell a token, make sure that the estimated number is on the BNB or Ethereum field.

The error is related to whichever place that the estimated number is from, regardless of your slippage tolerance.

However, if your slippage tolerance is too low, your transaction might still fail even if the estimated number is on the BNB or Ethereum field.

Hence, make sure that you set a slippage tolerance of 12% or higher before you make the swap.

In addition, when you’re changing the number of tokens that you want to sell, make sure that you still have enough of the token.

Otherwise, the transaction will not go through.

When you’re buying, make sure that the estimated number is at the top.

On the other hand, when you’re selling, make sure that the estimated number is at the bottom.

Further reading

How to Fix Trust Wallet Not Showing Balance

How to Fix “No provider was found” on PancakeSwap

How to Fix “Pancake K” Error on PancakeSwap

About the author

Lim How Wei

Lim How Wei is the founder of followchain.org, with over 7+ years of experience in Social Media and 3+ years of experience in investing in stocks and cryptocurrencies. He has researched, tested, and written hundreds of articles ranging from social media platforms to messaging apps.