The same issue happened to me. I just had to run brew repair, a command suggested in the error message. It fixed the problem while still using a VPN.
brew repair