1. Connection issue- check the printer wire is connected to the switch and power port of printer.
2. Out dated drivers :- check the drivers if they are out dated please update them as soon as possible.
3. Check the settings of your printer and computer.
after recognizing the reason behind getting error contact hp printer technical support