Invalid enum code when using Pkg

I am installing MPIPreferences using Pkg. But there is some argument error that has been shown in the picture below.

FWIW, I can’t reproduce (macOS, Julia 1.10.3, clean environment).

Looking at your error message more closely, it seems that there is a Git fetch error when Pkg tries to update the registry. So I’d assume that this is completely unrelated to MPIPreferences.jl. To check that, do you also get an error when you try to add any other package, say Pkg.add("Distributions"), or directly try to update the registry ] registry up?

You are right. I am getting the same enum code error while installing other packages or updating registry using ] registry up .
Any idea how can I rectify this error?