sudo: setrlimit(8): Invalid argument after switching Mac OS shell from BASH to ZSH
I had this message as well.

I think I've might have worked out a solution to it.

Check which version of sudo you have installed with sudo -V and if it isn't 1.8.31 download the newest version from here GitHub
You'll have to download this one here "sudo-1.8.31.mac1015.pkg"

Let me know if it worked out for you!