The easy answer is that it is a bad battery. You should have a built in HP diagnosis utility that you can access on boot up by hitting a key like F2 when you get the splash screen (BIOS screen text at startup). There should be a battery health test in one of the options. My HP Pavilion G7 has it. Here's how to access it:
https://support.hp.com/lt-en/document/c03467259
^^Scroll down in the Component test menu to where it shows the Power option, then look for the battery test option. Here's a direct sub-link to that:
https://support.hp.com/lt-en/document/c03467259#batterytest
The more difficult answer is that the CMOS battery itself is dead, which may also cause that error. The CMOS battery is a little coin sized battery that all PCs have to keep the internal clock going and whatnot even when the laptop is unplugged and without a battery attached. You'd have to take it to a shop to get replaced if that's what it winds up being. I've worked on laptops and they are no fun at all to take apart and put back together (read: labor costs more than the part replacement). This is highly unlikely however is that they are designed to last many, many years before needing replacement.