ValheimWorldConvertDiag
Diagnostic BepInEx plugin for locating malformed legacy inventories that cause Valheim 1.0 world conversion to fail.
About this mod Author’s original text
ValheimWorldConvertDiag
Diagnostic BepInEx plugin for tracking down legacy inventory data that causes Valheim 1.0 world conversion to crash.
This was created after a previously healthy vanilla world failed to load after updating to Valheim 1.0 with:
System.NullReferenceException: Object reference not set to an instance of an object
at ItemDrop+ItemData.IsSameType
at Inventory.AddItem
at Inventory.AddTempItem
at Inventory.LoadOld
at ZDOMan.ConvertInventories
World load failed mid-file. Exiting without save. Check backups!
The same world loaded correctly on the previous Valheim version, including backups going back about a year.
The problem turned out to be one malformed legacy container inventory.
What this plugin does
ValheimWorldConvertDiag patches the legacy world inventory conversion process and logs the inventory and ZDO being processed when conversion fails.
It records details such as:
- inventory size
- loaded item count
- last item name
- prefab hash
- stack size
- durability
- inventory grid position
- crafter data
- ItemData.IsSameType() state
- m_shared null state
- recent items processed in the same inventory
- source ZDO UID
- source ZDO world position
- source prefab hash
The most useful part is the ZDO position.
Instead of manually opening hundreds of chests, you can use the logged coordinates to find the exact world object causing the conversion failure.
Important
This plugin is diagnostic only.
It does not:
- modify world data
- delete items
- skip broken inventories
- suppress the original exception
- automatically repair the world
Always work from a backup.
Confirmed real-world case
The world used to develop this plugin contained more than 1.4 million ZDOs and had never been modded.
Valheim 1.0 failed while converting this legacy inventory:
Inventory size: 4x4
Loaded items before failure: 6
Recent items included:
Wood x50 pos 1,0
Stone x7 pos 3,0
Stone x50 pos 0,1
CharredBone x50 pos 2,1
CharredBone x50 pos 4,1
CharredBone x14 pos 1,1
Wood x38 pos 4,1
The suspicious part was that a 4-wide inventory contained items at:
pos=4,1
and multiple items appeared to overlap at that same position.
The crash occurred inside:
ItemDrop+ItemData.IsSameType
while both ItemData objects had:
m_shared=
The plugin identified the source ZDO as:
UID: 1:183157
Position: (-866.75, 31.46, -8632.98)
Prefab hash: 328745978
That location turned out to be an unimportant chest at an old Ashlands landing camp.
The world was loaded using the previous Valheim version, the offending chests were destroyed, dropped items were removed, and the world was saved again.
After that, Valheim 1.0 converted the world successfully.
Recommended recovery workflow
Do not try to repair the world directly in Valheim 1.0.
The safest process is:
- Keep an untouched backup of the original pre-1.0 world.
- Run Valheim 1.0 with this diagnostic plugin.
- Let conversion fail normally.
- Read the logged ZDO coordinates.
- Switch back to the previous Valheim build.
- Load the same world on that older version.
- Travel to the logged coordinates.
- Remove or empty the offending container/object.
- Save the world normally.
- Switch back to Valheim 1.0.
- Try conversion again.
- Repeat if another malformed inventory is found.
This avoids editing the save file directly.
Using the previous Valheim build
Valheim keeps an older stable branch available through Steam.
For the regular game client:
- Open Steam.
- Right-click Valheim.
- Select Properties.
- Open the Betas tab.
- Select the previous stable branch, commonly named:
default_old
- Let Steam download the older build.
- Start Valheim.
- Load the affected world.
- Fix the object at the coordinates reported by the plugin.
- Save and exit cleanly.
When finished:
- Return to Properties > Betas.
- Switch back to the normal/default branch.
- Let Steam update to Valheim 1.0 again.
- Retry the world conversion.
Branch names can change over time, so if de
Install & use Install: BepInEx plugin
- The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
- Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
- Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
- Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.
Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file. In multiplayer, the host and every client need the same mods installed.
Install these first, or the mod will not work: