There probably isn’t too much you can do from your side. If it couldn’t find the file on the mirror, chances are it wasn’t up-to-date completely when you hit it. I have experienced it from time to time, sometimes it’s easy enough to do:
dnf clean all
dnf update
and then all is well again. That said, sometimes the problems can be persistent, if you again end up connecting to a mirror that doesn’t have all the necessary files. Chances are it’s a one-off, from Rocky 8.7 just being released, and not all mirrors fully in sync.
If you are consistently getting problems continually in the near future, then let us know and perhaps we can get someone to take a look into it deeper.