I had similar problems after the upgrade to 24.04 and after much investigation I was able to come up with the following which seemed to work. There's seems to be some remnants of old config and some executables that didn't get deployed properly during the upgrade.
**NOTE: This will uninstall all hplip support in the process so any HP printers/scanners you have that are working will be uninstalled in the process.
First, I ran below to get a list of currently installed:
apt search hplip
I then went through the list of packages and purged all that were installed. You may have different packages. In my case it was:
apt purge printer-driver-hpcups libsane-hpaio libhpmud0 hplip-data
Make note of any files/directories that were not removed by the install. I had to manually remove those which I think was the key. Reinstalling the packages didn't seem to do the trick. I had also tried purging and installing again and that didn't work either.
In my case these directories needed to be removed:
/etc/hp
/usr/share/hplip
After those were removed, I installed only hplip:
apt install hplip
Then, I needed to run the hp-setup program. It's best to run that as a normal user and not with sudo or sudo -s. I chose a manual install in the wizard under advanced and entered the IP of my printer. I picked it up and installed it and printed the test page.
Hopefully this helps. I see a lot of people having issues with HP printers and scanners after the upgrade from 22.04 or 23.10 to 24.04. Perhaps there's some issue in the upgrade process with these packages. If it's the same issue I had, this should fix it.
Good luck!