Diagnosis
Your printer's wireless setup is stuck in a loop, often caused by a mismatch between your router's 2.4GHz/5GHz network settings or a failed initial handshake.
How to Fix It
Start with a full network reset on the printer. Go to the touchscreen: Setup > Network Setup > Restore Network Settings. Let the printer reboot. Then, reconnect using the HP Smart app on your phone/computer. During setup in the app, when it asks, connect your phone to the printer's direct "HP-Setup-xxx" Wi-Fi network—this method is more reliable than the touchscreen wizard.
If That Didn't Work
Your router might be blocking the connection. Temporarily disable the 5GHz band on your router (or give the 2.4GHz network a distinct name) and try the setup process again. The printer only works on 2.4GHz networks.
Heads Up
After connecting, if you add the printer to a computer via Windows "Add Printer," it may create a duplicate, non-functional entry. Always use the driver installed by the HP Smart app.