Fix a Corrupted level.dat

Supports Minecraft Bedrock Edition and Java Edition — and every server core for both, popular or obscure: Vanilla, Paper, Spigot, Purpur, Folia, Fabric, Forge, NeoForge, Mohist, Sponge, Bedrock Dedicated Server, PocketMine-MP, Nukkit, PowerNukkitX, Cloudburst, Dragonfly, Endstone, LeviLamina and the rest. Full list.

A world that refuses to load usually has one of four problems: a truncated level.dat from a crash during save, the wrong compression after a hand edit, a broken Bedrock header length, or a tag whose type was changed. Drop the file below — the editor reports exactly where parsing stopped, which narrows it to one of the four in seconds.

Diagnosislevel.dat_oldHeaderCompressionTruncation

Drop level.dat or level.dat_old here

level.dat · .nbt · .mcstructure · .schem · .schematic · .dat · chunk dumps

What actually breaks

SymptomCauseFix
Editor reports "Unexpected end of data"Truncated file — the process died mid-save, or the disk filled upRestore level.dat_old or a backup; the missing bytes are gone
Game says the world is corrupted, editor loads it fineWrong compression or byte order written by another toolRe-save here with the correct format for the edition
Bedrock world missing from the listHeader length no longer matches the payloadOpen and save here — the length is recalculated automatically
Server logs a class-cast or type error on loadA tag's type was changed by hand (Byte where an Int is expected)Set the tag back to the type the game expects
World loads but spawns you in a fresh worldlevel.dat was replaced by a newly generated oneRestore the backup; the chunks in region/ or db/ are usually still fine
Nothing parses, including _oldStorage failure — the filesystem returned zeros or garbage for bothRestore from an off-machine backup; check the disk before trusting the host

Salvaging a world without level.dat

The world's terrain, chests and players do not live in level.dat — they are in region/ (Java) or db/ (Bedrock). If the metadata file is beyond repair, create a fresh world with the same version and settings, then move the chunk data into it and set LevelName, spawn coordinates and game rules on the new file. You lose the metadata, not the builds. Confirm the version first: a Java world carries DataVersion, and the freshly generated file must not be older than the chunks you are importing.

Preventing the next one

  • Stop the server before copying or editing. Most corruption starts as a file copied while it was being written.
  • Snapshot on a schedule, off the machine. A backup on the same disk does not survive the storage failure that caused the problem.
  • Use save-off / save-all around live snapshots so the copy is taken against a quiesced world.
  • Watch disk space. A full disk truncates saves silently, and level.dat is written last.
  • Edit values, not structure. Renaming tags or changing their types is the one edit the game cannot forgive.

Frequently Asked Questions

What is level.dat_old?

The previous save. Minecraft renames the current file to level.dat_old before writing a new one, so it is a one-generation backup that costs nothing to try first.

Can an NBT editor repair a truncated file?

It can tell you exactly where the data stops, but the missing bytes cannot be reconstructed. A partial parse means you need a backup.

Will I lose my builds?

Not from a broken level.dat alone. Chunks live in region/ or db/; a fresh world file with the same version can adopt them.

The server says level.dat is fine but the world is empty.

Then the chunk storage is the problem, not the metadata. Check that region/ or db/ came along with the copy and that the spawn coordinates in level.dat point where you expect.

Related tools