Well.. I have encountered this thrice- once due to a crash and kick from server- corrected by caching- couldn't load my own worlds let alone connect to anything. Another was a mod failure- removed mod, cache- ok. Last am still unsure of why but I uninstalled- dumped .minecraft folder and reinstalled, then dragged the world.
I would check the world folder if it is indeed a local one and not a server- remove any datapacks in the folder. If any mods are presently installed that require it or are responsible for putting it there- remove them. Test again. If it is a remote server- the datapack required may be different than that you use or is being loaded for that world etc happened on one of my pre-paper servers where the server required pack was at fault.