This error in my case is caused by automatically, but in your case, it might be different.
How to Fix Laptop 0% available Plugged in but not Charging in 6 Simple Steps
Step 1: Go to Google and type the name of your laptop and then add drivers next to it.
Eg: If your laptop's name is Acer, type in Google "Acer Drivers".
Step 2: Click on the link from the official laptop manufacturer (usually the first or the second link).
Step 3: You need to now enter the category/model/series number of your laptop.
Step 4:
Go to the Bios/Firmware tab and scroll down to see Power Management
(this location might be different for other laptops but basically, you
need to download the latest drivers for the power management).
Step 5: Download and Install the driver.
Step 6: Restart your laptop.
Step 7: Done! :)
You are welcome to share your ideas with us in the comment!