I wonder if your issue is related to Apple's use of a Bonjour Sleep Proxy
https://en.wikipedia.org/wiki/Bonjour_Sleep_Proxy
Maybe it's changed recently, but it used to be that you needed one or more on your network for the usual service requests to wake a sleeping Mac that was providing a service. Apple TVs provide a sleep proxy, as did the now-discontinued Airport Extreme/Express/Time Capsule devices. It may be that whatever method(s) you're using to send the WOL packet aren't sufficient -- that macOS wants something more (something from the sleep proxy)?
Can you wake the sleeping computer
from Finder on another Mac -- for example, for File Sharing (SMB) or Screen Sharing (VNC)? (Of course the services must be enabled on the sleeping Mac ahead of time.)
This command will show the sleep proxies on your network (if any):
dns-sd -B _sleep-proxy._udp
I have three, with two interfaces each, apparently (yes, I still use a Time Capsule!):
Code:
brian@mini4:~(0)$ dns-sd -B _sleep-proxy._udp
Browsing for _sleep-proxy._udp
DATE: ---Sat 22 Mar 2025---
18:38:27.022 ...STARTING...
Timestamp A/R Flags if Domain Service Type Instance Name
18:38:27.023 Add 3 7 local. _sleep-proxy._udp. 50-34-10-70.1 timecapsule2
18:38:27.023 Add 3 7 local. _sleep-proxy._udp. 70-35-60-63.1 lounge-applebox
18:38:27.023 Add 3 16 local. _sleep-proxy._udp. 50-34-10-70.1 timecapsule2
18:38:27.023 Add 3 7 local. _sleep-proxy._udp. 70-35-60-63.1 basement-applebox
18:38:27.023 Add 3 16 local. _sleep-proxy._udp. 70-35-60-63.1 lounge-applebox
18:38:27.023 Add 2 16 local. _sleep-proxy._udp. 70-35-60-63.1 basement-applebox