Was it a brand name battery, or a discount battery? When you look at the price of the price of replacement Ryobi/Milwaukee/Dewalt etc batteries, and then see third-party knockoffs on Amazon for 1/3 or less of the price, it's tempting to save money.
If you understand that the battery management controller is built into the battery pack and not the tool itself, the temptation to save money is replaced entirely by the fear of burning down a building. Not worth it.
https://www.amazon.com/dp/B07LFWN86Q
Joiry
Yep, big mistake.