Crash when trying to load Save

I was a couple of sessions into the multicellular stage, when I got a crash leaving the editor. I tried to load my last save, which was just before I clicked ‘Become Multicellular’, but every time I try to reload it, it gives the same error (‘KeyNotFoundException’) before either returning to the menu, or the credits. I was able to continue to multicell after I made this save, so presumably the error is just in the save itself.

Here is the log:

When I made the save, I had formed a temporary colony of 5 cells. Some of them had jumped to weird and overlapping positions when we joined up. I thought that might be related to the saving issue.

Could you provide the save file or your json_debug.txt log file which has most of the important save related information?

1 Like

Alright so I investigated that save and I think I found the root cause: a chemoreceptor upgrade was made to detect the species that chemoreceptor was in. That caused a dependency on needing to load the species before its organelles.

I think I managed to create a fix by making the species organelles be saved last so that the species object can be created before that to allow the JSON to refer to its ancestor without error.

It was relatively simply to manually repair the save file, I’ve uploaded that here if you want to continue playing that save:

PR with the fix is here:

Many thanks! It mostly runs perfectly now.

1 Like

Game doesn’t crash, but a popup shows up with this error:

I made this save during editor session and my creature had chemoreceptor, flagellum and two hydrogen sulfide chemosynthesizers, two metabolosomes and a pilus.

1 Like

When was the save made? Was it made with It seems there is a null value for a entity system that has a non-nullable (i.e. the value is never allowed to be null) variable it needs.

1 Like

Yes, it was

If you try to recreate the conditions does the problem happen again (is this a random chance of the problem happening)? And could you please upload the broken save somewhere for me to take a look and?

1 Like

I noticed that it can’t load whenever there is newly placed hex when the save was made (so if all hexes are from previous sessions, it loads). In freebuild it also happens, but not during initial editor session.

Here’s save from freebuild just in case:

Something very weird is going on with that save. I tried saving in editor with a newly placed hex, but I did not get any weirdness happening. I can at least confirm that the save is broken due to this part:

      "SavedPatchManagerBrightness": null,

I checked the code for that property and it should be simply impossible to get a null result from it:

    public float SavedPatchManagerBrightness
        get => patchManager.ReadBrightnessForSave();
        set => tempPatchManagerBrightness = value;

The saving process itself should fail with a null reference exception if there is any chance that the patchManager object was somehow missing.

Can you try using the official release and come up with some sequence of steps that trigger the bug?

Okay, I managed to recreate this error by:

Entering freebuild → leaving editor (I didn’t place any hexes) → entering editor again → going to the Editor tab → Saving the organism as-is → loading the save → placing new hex (I placed cytoplasm) → overwriting (saving the save with the same name as the latter) → loading that save

I was very surprised that that actually worked to trigger the problem. I think I found the root cause which was making a save in the editor after loading a save made in the editor (without going to the microbe stage in between). This causes the temporarily stored patch brightness value to not be applied, and when the brightness is saved again the stage is not initialized so it somehow is able to grab a null value without crashing.

I made a fix for this by re-saving the previously stored temporary value if the stage is not initialized when making the save: