Not specific case for OP, but in my case, brew doctor
clearly said that my "homebrew/core tap has a problem", so I did:
$ rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core" &&\
brew tap homebrew/core &&\
brew update
and everything worked well.