Please attach a screenshot of the error message and please attach the full launcher log found in [minecraft/launcher_log.txt|https://minecrafthopper.net/help/finding-minecraft-data-folder/].
When does this error occur? Does it occur on every world? Can you try a new 1.21 created world?
I am legit having the same issue, it really sucks not knowing what is causing it or if you'll ever play on realms again.