Removing a data pack using a custom dimension with one or several custom biome will return a "java.lang.IllegalStateException" error from level.dat and make the world unreachable.
Using the "Safe Mode" button won't fix.
Removing the "/dimensions/<custom_dimension>{}" folder from the world won't fix.
How to reproduce:
Create a New World and install the example data pack from the attachments.
Load the world at least once to initialize the worldgen change.
Close the world, remove the data from the "/datapacks" folder.
Try to join the world.
Current result:
The world is not reachable anymore, returning an error: "Exception reading C:\Users\<User>\AppData\Roaming\.minecraft\saves\<World>\level.dat
java.lang.IllegalStateException: Trying to access unbound value 'ResourceKey[minecraft:worldgen/biome / example:custom_plains]' from registry Registry[ResourceKey[minecraft:root / minecraft:worldgen/biome] (Stable)]{}"
Expected result:
Since the custom biome is only used in the custom dimension, the game should be able to remove both of them (removing a data pack that uses a custom dimension that doesn't use a custom biome doesn't cause any issue).
Why is this very problematic?
Even if it is an experimental feature, many data packs already use custom dimensions with custom biomes. Players probably expect those data packs to be removable in the case they don't want it anymore, or for the potential moment they will try to open their world on a future version that is not supported by the data pack anymore/yet. This issue condemn those players to always use the data pack, or lose their world.
Attachments
Comments 3
Yes, I meant "removing a data pack that provides a custom dimension [...]".
I edited it to be more explicit.
The game doesn't remove custom dimensions at all; their generation settings get saved to the level.dat and remain loaded in when all (but vanilla) data packs get disabled.
I think the best fix for this is defaulting any unknown biome to one of the vanilla biomes, but not changing the saved ID (just saying "I don't know this ID, so I'll create an duplicate of the default biome with that ID); also prevents loss of data when the biome gets re-added.