I just posted in the pacman thread, but I’ve overcome this error by reinstalling/rebuilding (I don’t know the correct term!) yay
directly from the github page with
sudo pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si