Kenshi
146 ratings
Removing Corrupt Zone Data
By Shidan
A somewhat common cause of crashes for Kenshi is corrupt zone data. It will manifest as a crash to desktop whenever you enter a specific region of the map. This guide will walk through the steps to manually remove the corrupt zone data using the FCS.
6
4
4
   
Award
Favorite
Favorited
Unfavorite
Prevention and Save Game health
It's not entirely clear what causes the zone corruptions, but below I will post several tips on maintaining good save game health, which should minimize your risks of corruptions and a number of other bugs. Following these steps I almost never encounter major issues, and when I do they are easily recoverable.

  1. Avoid autosaves and quick saves, preferably disable autosaves entirely. Game doesn't handle overwriting well, and autosaves can cause mass file deletions if they happen at the wrong time.
  2. Make new saves instead of overwriting, as before the game doesn't handle overwriting well. Manually delete old saves from the folder itself if needed.
  3. Don't load save or start new games while in-game. The exception being that if you're loading a recent save of the same file you're playing currently. The game has trouble unloading data from its memory, so switching saves can cause issues with some of the data being brought over.
  4. Import semi-regularly. I personally do every couple irl weeks when I'm actively playing, and always import a save whenever I first come back to a save. Also always import after game updates and adding/removing mods. Importing clears excess data that can cause issues, and makes sure your save is up to date with any update or mod data.
  5. When saving, always wait until you see the "save successful" message before unpausing the game or exiting the game. Interruptions during this period can cause the save to corrupt. And in very rare cases delete other unrelated saves.
  6. When encountering pathing issues you can use Ctrl + Shift + F11 to regen the navmesh, this will also fix some incorrectly saved flags on buildings which may slightly improve performance. Do NOT use the "Fix Stuff" button in the editor instead, as that can delete certain elements and break saves or mods.
  7. Always keep backups, just in case. Even if you're just keeping extra saves in your save list, that's better than nothing. If something goes wrong, being able to recover at least something is important. Personally I do that, and also have a program that backs up everything on my computer online automatically.

Failing to follow these isn't going to guaranteed break your save or anything. I didn't follow most of them for most of my years here, and never encountered any of the major issues on my saves. But it's simply ways to minimize your risks. :)
Testing for Zone Corruption and other issues
The first step for fixing zone corruptions is to find out if you actually have any, or if it's a different issue with similar symptoms. Remember, when running these tests, it is advised to not save the game to avoid any issues with your save, you're just loading the save as a test to see what effects it has..

1. Mods
Test if disabling mods resolves it. The best way to do this is by simply turning off all mods, then loading your save up. Make sure to back up your mods.cfg file located in your Kenshi/data folder, as that will preserve your mod list and load order, so that you can recover it by simply copying it back in.

If disabling mods resolves it, it is advised to run several tests to identify which mod is the culprit. My preferred method is by disabling only have your mod list, then testing. If it works now, you know the culprit is in the half you turned off, so turn half of them back on and test again. If it doesn't work, you know it's in the half you left on, so turn off half of the remaining mods. Repeat as needed.

It could possibly still be zone corruption, if it was a mod related object that was corrupted. Though it may be simpler to just disable the mod than trying to remove the corruption specifically. Test steps 3 and 4 with the mod in question on to confirm if it's save data or mod data causing the crash.

2. Distant Towns
A common cause of a crash in specific areas of the world is Distant Town generation. For some reason, some users crash when the game tries to generate the meshes for them. The test for this issue is simple, disable the "generate distant towns" setting in the options menu in the graphics section.


3. Import
Just a simple import with the default options selected. This one is a test for other possible issues in the save that are not zone corruption. Too many possibilities to list here, and they'd be too varied to give any real advice on what other options there are to fix it. You'd have to either investigate your log files yourself after the crash, or make a bug report and post them for myself or someone else to look at.

You could also just move on and keep playing after an import if you don't care about the exact cause.

4. Import Without Buildings
This is the test for zone data corruption, the whole reason for this guide. Importing without buildings wipes all zone data from the save, so if it works now when the normal import didn't, you know the problem must have been from the zone data.

5. New Game
Start a new game (from the main menu of course, not in a save), and head to the location you were experiencing crashes. This is the final test for common causes of crashes in specific areas.

If it does not crash, it must be something from your save causing it, if none of the above steps help I would suggest a bug report and uploading the save.

If it does still crash, navigate to Kenshi\data\newland\land\overlaymaps and delete all files inside. Then revalidate your files. Sometimes some of the files int hat folder can be corrupted, and cause crashes when they are called up in the game.
Removing the Corruption
So at this point you should have run the tests above, and if you've determined that your issue is actually zone corruption, you should proceed from here.

Locating the corrupt data
The first step is to figure out where the corruption is located. Go to the save folder for Kenshi (C:\Users\YourUsername\AppData\Local\kenshi\save), make a back up of your save, and then navigate to your save's zone folder.

You should now see a number of files, each with two numbers on them like this.


Generally the corruption will be in one specific file, sometimes even a specific item in said file. But first we have to figure out which file the problem is in. The simplest method for this is similar to the mod testing we did before (though if you like you can try to identify the zone based on this map[static.wikia.nocookie.net]. Numbers on the files are column.row)

Start by deleting half of the zone files, then testing the save.

If it works, you know the issue was in the half you deleted, so copy the zone files back over from your back up save, and only delete half of what you deleted the first time.

If it still crashes, you know it's in the half still remaining. So delete half of the remaining files.

Repeat this process several times, and you should quickly narrow it down to an individual file. The save should work fine without said file even if all other files are still in the folder, and crashes if the file is still there.

File corruption vs object corruption
Now we test to identify what type of corruption you're facing. These present identically in-game, so we have to use the FCS to edit the file from here on.

Luckily, this is quite a simple process to see which type it is. Just open the file using the FCS.

One way to do this is by using the "Open any" button in the FCS, then navigating to the save folder and opening the file.

Another way (and my preferred method) is by right clicking and selecting "open with..." on the file, scroll down until you find the option to look for another program to open it with, after selecting it navigate to the kenshi folder using the window that pops up, and select the "forgotten construction set.exe" file. You can check the "always use this app to open files of this type" to make it the default program, meaning that later on you only have to double click the file to open it in the FCS.

However you have opened it, you'll now be faced with one of two screens.

If you have file corruption you'll get something like this one:

The only solution in this scenario is to delete the file. Nothing can be recovered from it, so if you owned any buildings there you'll simply have to rebuild them.

If you have object corruption (or if there is no corruption at all), you'll be met with this:

In this scenario we will move on to the next step.


Removing object corruption

If you've determined you have object corruption, we need to go about locating the corrupt object and removing it. If you had file corruption instead, you need to delete the file instead, this section is only for object corruptions.

First step is to create two new columns. You can do so by right clicking int he main window with the objects in it, go down to the "columns" option and select "Type", then do the same for "StringID".

You should see a "type" column in the window, this shows you type each object is. The only ones we'll concern ourselves with here are the "GAMESTATE_BUILDING" type objects. You'll also see an ID for each object, which will help us keep our place.

Before doing any testing, I would advise sorting the columns by String ID by clicking the "StringID" column near the top of the window, then immediately clicking "Type" instead. This will use stable sorting to sort them by Type, and then by String ID, making it easier to keep your place. Like shown below.


Much like when testing for file corruption, we'll delete about roughly half of these "GAMESTATE_BUILDING" entries, save the file using the button in the top left corner, then test the save. I advise using the String ID column to keep your place (i.e. delete all objects with String IDs that start with 0-5, then test, etc.) If it works, you know it was in the half you deleted. If it doesn't work, you know it's in the half remaining. Repeat as needed to track down the corrupt object.

You can copy the file over from your back up save to restore the file back to its original state during the testing. Do note that when you reset the file this way, you'll need to reopen it in the FCS, and set your columns and sorting back up each time.

Eventually you should narrow it down to a single object. Make a note of the String ID of the object, reset all the files using your back up, then go back in and remove just that one object. The save should now work, and all that should be missing is the one object that was corrupted.
22 Comments
neanter 16 Mar @ 7:29am 
Alright! After narrowing it down, this actually worked. Fantastic attention to detail and description of processes required to achieve the goal. Thank you. For those trying this out, it might be interesting to note that copying the zone's folder from a previous working save did not work as the following autosaves were also corrupted. I thought it might be a decent compromise.
DishyMisterBat 23 Oct, 2024 @ 4:08am 
wrongfoot you are a bozo bro
nubbyclairvoyant 22 Jan, 2024 @ 7:31am 
Spoke too soon: deleted mod, imported save near Slave Market South (where said NPC spawns)..but still get ctd approaching SMSouth. Reinstalled mod, and tried both of its custom starts--and both ctd before char looks screen.

Using your method for Zone corruption, I found that deleting a single zone--21.31--caused ctd on loading if it was deleted. Guess I need to retest method, and see if deleting any one zone file allows approach to SMSouth.
nubbyclairvoyant 22 Jan, 2024 @ 6:40am 
Thanks for this guide, Shidan! Was crashing on approach to Slave Market South...yet had never been there (thus, no building). Determined it was a mooded NPC who's spawned there; not zone corruption. But wouldn't have figured it out without your guide getting my brain pan working.
Echo 14 Oct, 2023 @ 6:07pm 
Wheel Skeleton same, game just freezes and thats it
Wheel Skeleton 4 Sep, 2023 @ 2:25am 
Ngl I had been playing for like a week without being able to go to the Deadlands. Anytime I needed to pass through I would just click on the map where I wanted the character to go and keep my camera focused on someone outside the deadlands and just pray they made it through with no issues. I fixed the issue before I found this (no idea how tbh) but now I'm glad I have something to help if it happens again.
Bending Unit #3370318 3 Apr, 2023 @ 7:10pm 
This is very helpful. Thanks a ton. Just troubleshooting and it's a corrupt zone data issue.
OminousRuin 5 Oct, 2022 @ 1:26pm 
Thank you so much! I kept crashing around World's End and was dreading having to scour the forums looking for a solution. I disabled generating distant towns and that fixed it for me! Really saved my squad haha.
Totentanz 21 Sep, 2022 @ 9:49am 
awesome! thanks.
Chincha40 16 Jul, 2022 @ 11:15pm 
Thank you so much for this guide. It let me keep playing the game after I had exhausted every other option I knew of. I had recently enabled the distant towns setting and when I disabled it all the problems vanished. I tried everything from verifying files 5 times and reinstalling the mods over and over, eventually backing up my saves and reinstalling the game and that still didn't work to solve the crashes.
Then I read this post, disabled auto saves and rewrote my latest quick save as a actual save, then disabled the distant town rendering and that fixed it.
I spent 12 hours trying to fix the game today and I was ready to give up and stop playing completely thank you so much.