This type of issue occurs when the settings are not as per your preferences in the period of inactivity section. It depends on the settings which are set as to when the printer will go in Sleep mode. The default time set is 5 minutes. You can change the period of inactivity of the printer before it sleeps.
On the printer’s control panel, view the home screen to open the Setup menu and click OK.
Tap Printer Settings and click OK.
Open Power Management and click OK.
Tap Sleep Mode and press OK.
Choose your desired options and select OK.
The sleep mode cannot be turned off so if this doesn’t work, you can assign a static IP on the printer and it should resolve the issue.
If the issue continues, set a static IP on your printer by following the steps mentioned here.
Get the IP address of the printer.
For this, tap the Wireless icon on the printer control panel to obtain the IP address.
Enter the IP address on a web browser to acquire the printer EWS page on your computer.
Open Network>General>Network protocols>Enable IPv4 only.
Apply the recent settings.
Go to the Network option, tap Wireless (802.11), and click Network address (IPv4).
Tap the radio button which displays Manual IP and select Suggest a manual IP address to assign a manual IP address to your printer.
Select the radio button which displays Manual DNS Server, and under the manual preferred section, enter 8.8.8.8 and in the manual alternate, type 8.8.4.4.
The mentioned address if the Google DNS server address.
The solutions given should Resolve the error.