Check which Xcode raised the error
The Xcode app on screen and the Xcode used by Terminal or CI can differ. Run these read-only checks where the build actually fails. A mismatch is a reason to check that build’s tool selection, not to change the global setting on a shared Mac.
xcode-select -p
xcodebuild -version
xcodebuild -showComponent metalToolchainInstall the component if it is missing
In the matching Xcode, open Settings → Components and find Metal Toolchain. Choose Get if offered, wait for installation to finish, and rerun the original build. If the download fails, keep the first error, check available storage and confirm the active Xcode again. Do not remove a system folder to clear a download error.
What if the component already shows installed?
On our Mac, Xcode 26.2 reported Status: installed in the read-only check. We did not reinstall the component or reproduce a download failure. If your build still fails, compare tool selection in the working and failing environments, then read the first actionable error. A shader source error is not evidence that the toolchain needs reinstalling.