Skip to content

[1.21.11+/26.1] World migration fails when legacy world folder still exists alongside migrated dimensions #66

@GG-MD

Description

@GG-MD

Hi, @Dev7ex.

Description

When MultiWorld attempts to load a world that has already been partially migrated to Paper's new dimension folder structure (./<world>/dimensions/minecraft/<name>/) but the legacy folder (./<name>/) still exists, the migration crashes with Refusing to overwrite existing migrated file ... while moving .... As a result the world is not loaded, and any plugin that depends on it fails too.

This started happening after Paper changed the world folder layout (CraftBukkit world layout deprecation). MultiWorld calls Bukkit.createWorld(...) which triggers LegacyCraftBukkitWorldMigration, but Paper refuses to overwrite already-migrated region files instead of either skipping them or merging.

Environment

  • Server: Purpur 26.1.2-2570 (Paper API 26.1.2)
  • Java: 25.
  • MultiWorld: 1.7.7-SNAPSHOT
  • FacilisCommon: 1.0.7-SNAPSHOT

Steps to reproduce

  1. Have an existing world (e.g. mine) created on an older Paper version with the legacy layout (./mine/region/, ./mine/level.dat, etc.).
  2. Update server to Paper/Purpur 1.21.11 / 26.1.x.
  3. Start the server. Paper begins migrating files from ./mine/ to ./world/dimensions/minecraft/mine/, but the migration is partial / the old folder is left in place.
  4. Restart the server with MultiWorld trying to auto-load mine.

Expected behavior

MultiWorld should either:

  • detect that the world has already been migrated and load the new path directly, or
  • handle the RuntimeException from createWorld gracefully (log it and skip the world) rather than letting FacilisCommon's PluginModuleManager.enableAllModules propagate the exception.

Actual behavior

[FacilisCommon] FacilisCommon has detected an error in the plugin MultiWorld
java.lang.RuntimeException: Failed to migrate legacy world mine
    at org.bukkit.craftbukkit.CraftServer.createWorld(CraftServer.java:1239)
    at MultiWorld-Bukkit-1.7.7-SNAPSHOT.jar//com.dev7ex.multiworld.world.DefaultWorldManager.loadWorld(DefaultWorldManager.java:569)
    at MultiWorld-Bukkit-1.7.7-SNAPSHOT.jar//com.dev7ex.multiworld.world.DefaultWorldProvider.onEnable(DefaultWorldProvider.java:93)
    at FacilisCommon-Bukkit-1.0.7-SNAPSHOT.jar//com.dev7ex.common.bukkit.plugin.module.PluginModuleManager.enableAllModules(PluginModuleManager.java:49)
    ...
Caused by: java.io.IOException: Refusing to overwrite existing migrated file ./world/dimensions/minecraft/mine/region/r.-1.0.mca while moving ./mine/region/r.-1.0.mca
    at io.papermc.paper.world.migration.WorldMigrationSupport.mergeMove(WorldMigrationSupport.java:116)
    at io.papermc.paper.world.migration.LegacyCraftBukkitWorldMigration.run(LegacyCraftBukkitWorldMigration.java:81)
    ...

The world mine is never loaded, and downstream plugins that reference it crash with NPEs on Location.getWorld() == null.

Suggested fix

Before calling Bukkit.createWorld(...), MultiWorld could check whether <serverRoot>/world/dimensions/minecraft/<name>/ already contains region files. If yes, skip the legacy migration path entirely and load the world directly. As a fallback, wrap the createWorld call in a try/catch and log a clear message instructing the user to delete the leftover legacy folder.

Workaround for users

Manually delete the leftover legacy folder (./<name>/) once you've verified its contents have been moved to ./world/dimensions/minecraft/<name>/.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions