The 0xC004F012 error means: The licensing subsystem (sppsvc service) does not find the installed license in the local storage or the storage itself is corrupted.
You may try so called repair install. Create Windows installation media as described at https://www.microsoft.com/software-download/windows11 but do not boot from this media, run setup.exe file from running Windows instead. This will keep all your files, apps and settings.