Sorry to ehar that you're getting an error while using Sky Replacement in Photoshop 22.4.2.
Would you mind going to Edit/Assign Profile and choose a different color profile? If it's RGB, try Adobe RGB.
If that does not help, Try resetting the Photoshop preferences: Press and hold Alt+Control+Shift (Windows) or Option+Command+Shift (Mac OS) as you start Photoshop. You are prompted to delete the current settings. The new preferences files are created the next time you start Photoshop.