You may be experiencing any of these issues:
This message usually appears due to a damaged charging cable, resistance in the connection, or a damaged charging port on the phone. Use this checklist to help identify the issue:
Ensure that the USB charging cable and wall charger are the HTC branded accessories provided with the device, and that they are in good condition.
Ensure no extension cords, surge protectors, or USB hubs are used.
Ensure that the charging port on the device is clean and free of debris, if foreign material is located please make use of a soft brush to clean the charging port.
Ensure that the HTC branded cable is working when used with other phones either connected to a wall charger or PC.
If the device has Fast Boot (HTC Sense 6.0 and lower), disable this setting and try again.
If the issue isn't resolved follow these steps:
Perform a soft reset using the hardware buttons.
Clearing the data cache may resolve the issue. See How to Wipe Your Cache Partition.
A factory data reset can resolve some software issues. See How to factory data reset a device.