After I had not updated my CentOS 8 for a while, I used the command "yum update" or "dnf update" for the update, but I encountered the below error:
To fix this error, you can run the below commands:
$sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
$sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Reference: Stackoverflow