I’m getting an error on Pancakeswap.

Typically errors on Pancakeswap are due to the slippage rate or a little bug with the calculated conversion. See this video for how get past it. This appears to be a bug with Pancakeswap’s code. Another thing that has worked is to lower the amount you are trying to purchase.