Locale issue with missing file

I normally use yay to update everything on my system as I have just a few AUR packages to keep updated and the last 2 updates where there were new packages I am getting a warning error:

(3/5) Checking which packages need to be rebuilt
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "",
LC_ALL = (unset),
LC_CTYPE = (unset),
LC_NUMERIC = "en_US.UTF-8",
LC_COLLATE = (unset),
LC_TIME = "en_US.UTF-8",
LC_MESSAGES = (unset),
LC_MONETARY = "en_US.UTF-8",
LC_ADDRESS = "en_US.UTF-8",
LC_IDENTIFICATION = "en_US.UTF-8",
LC_MEASUREMENT = "en_US.UTF-8",
LC_PAPER = "en_US.UTF-8",
LC_TELEPHONE = "en_US.UTF-8",
LC_NAME = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.

Then just keeps looping that error for a few times which I assume is for each package it is updating (today I only had 7 packages update)

endeavouros/bash-app-translate
core/coreutils
endeavouros/eos-update
extra/hunspell
extra/libvips
extra/python-configargparse
extra/python-dbus

I did a Local-gen and then a locale command and am getting this error, which I assume is related.

$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=“en_US.UTF-8”
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE=“en_US.UTF-8”
LC_MONETARY=en_US.UTF-8
LC_MESSAGES=“en_US.UTF-8”
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=

The error stays the same even though I have done a export LC_ALL="en_US.UTF-8"

What is this no such file or directory and how do I fix? I thought the locale-gen and the export command would resolve it. There isn’t anything in my locale.conf file commented:

LANG=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_TIME=en_US.UTF-8

Rerunning yay or a pacman -Syu doesn’t result in any rebuilds/errors so I am not sure if this is causing a system issue as well down the road.

Grok AI solved it for me.
note, my locale is -8 (Central Time)
Fix:

sudo sed -i 's/^#\s*en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
grep -n 'en_US.UTF-8' /etc/locale.gen
sudo locale-gen

Optional cleanup

### /etc/locale.conf does not need every LC_* line. This is enough:
textLANG=en_US.UTF-8
sudo install -m 644 /dev/stdin /etc/locale.conf <<'EOF'
LANG=en_US.UTF-8
EOF

So what exactly is this doing? I want to understand what is wrong before just running a command.

en_US.UTF-8 is missing from /etc/locale.gen.
First line will add it
Second line will verify the addition
Finally, regenerate locale

Thank you. I tried researching but I missed that I needed to uncomment it out of the .gen file. Thought I was just working with the .conf file for locale.

When you replied I had just parsed out the sed command (not one I use so was fighting through the wildcards).

Sorry to question you…just want to actually understand what was going on and what was missing as I really wanted to fully understand.

Thanks again.

No worries, you are welcome.