[Yes, this is sort of a canned answer. You are not the first to have installation problems.]
My belief is that this error you get mainly in the situation when a user tried to install SQL Server and it failed with some error. The user might have tried some random cleanup and made renewed attempts. Because the cleanup was incomplete, Setup now fails with another error than it did originally.
Could this apply to you? Or did this happen on the first attempt? (If it does apply to you, don't feel bad. I think it is quite a natural path to take.)
Here is a link to an article that can help you to clean up properly: https://www.sql-easy.com/learn/how-to-uninstall-sql-server/. I have not tried it myself, but I learnt about it from a user who was in a similar situation as yours, and who was able to install SQL Server successfully after following the article.
Since you are on Windows 11, be sure to read the article Troubleshoot errors related to system disk sector size greater than 4 KB before you try again. It discusses a known issue where Windows 11 reports a disk-sector size that SQL Server chokes on. This could be the cause for your original failure. Check out this article, and if needed apply the workarounds it proposes.