Page 1 of 2

[2.0.14] Corrupted Save(s) while debugging.

Posted: Tue Nov 05, 2024 7:27 pm
by Olipro
I have a save file I use for testing things in the game and somehow, it (and all autosaves taken within the last half hour) have managed to become corrupted with an error that says "Invalid bool loaded from input file. File could be corrupted"

This save does use a singular mod (Lua API global variable viewer) that lets me inspect lua objects but I wouldn't have thought it should be possible for it to cause save file corruption. I have not been altering the lua state during my playthrough, just inspecting objects I need to pull data from.

The save is attached.

Edit: some relevant lines that I found in the log, though you'll probably see them yourselves

475.343 Info Scenario.cpp:178: Map version 2.0.14-2
475.570 Warning Map.cpp:358: Map loading failed: Invalid bool loaded from input file. File could be corrupted.
476.124 Error AppManagerStates.cpp:1655: Invalid bool loaded from input file. File could be corrupted.

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Tue Nov 05, 2024 8:09 pm
by Rseding91
Thanks for the report however the map file is already corrupt. Do you have the non-corrupt version I can use and steps to get it into the corrupt state?

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Tue Nov 05, 2024 8:25 pm
by Rseding91
Looking at the save, there is exactly 1 byte that is corrupt which when fixed allows the save to be loaded. That has historically always meant failing hardware on the players computer. Most commonly bad RAM. I recommend running a memory test https://www.memtest.org/

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Tue Nov 05, 2024 8:51 pm
by Olipro
I booted a bootable memtest86 and had no issues. All the autosaves are also corrupted and were taken 5 minutes apart. I can upload them if you like but I'm pretty suspicious about blaming this one on hardware... unless the space station that's currently nuking the hell out of asteroids managed to rowhammer the memory (though if it flipped an entire byte and not a bit, that's unlikely), but that particular peculiarity is a universal vulnerability of all RAM.

For my own reference, can you give me the filename and offset I need to hexedit to make it functional again?

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Tue Nov 05, 2024 9:29 pm
by Rseding91
I don't know the offset sorry. It's on the character logistic point - the boolean that says if it requests from buffers or not. The save file is split into multiple chunks compressed in RAM and written into the zip.

It's possible there's some base game bug that corrupted it. But so far nobody has found any steps to take a known good save and get it into a broken state.

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Wed Nov 06, 2024 12:05 am
by Olipro
Alright, if I'm SOL then I'm SOL. If you can provide me with like ~20 bytes, even just a screenshot, maybe I can extract the zip, search the sequence from all the files in there and patch it.

No expectations but I'd sure appreciate it.

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Thu Nov 07, 2024 9:12 am
by gansgut
[2.0.14] Space age
I have same issue in same environment. I created dev world made for blueprints with activated /cheat and /editor a couple days ago. Today i get error dedicated to this world. Save and autosaves don't load with error "Invalid bool loaded from input file. File could be corrupted". Other saves work normally.

No mods
Memtest64 4 passes, no errors.

https://drive.google.com/file/d/1l5at2v ... share_link

Strings from log file:
39.749 Warning Map.cpp:358: Map loading failed: Invalid bool loaded from input file. File could be corrupted.
40.129 Error AppManagerStates.cpp:1655: Invalid bool loaded from input file. File could be corrupted.
42.431 Loading map C:\Users\konstantin\AppData\Roaming\Factorio\saves\_autosave2.zip: 60780484 bytes.
42.458 Loading level.dat: 159422493 bytes.
42.462 Info Scenario.cpp:178: Map version 2.0.14-2
43.738 Error RuntimeError.cpp:24: Invalid bool loaded from input file. File could be corrupted.
Factorio crashed. Generating symbolized stacktrace, please wait ...

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Thu Nov 07, 2024 12:53 pm
by Rseding91
Actually, someone found a reproduction for this here viewtopic.php?f=30&t=120101 In a rare first, "invalid bool loaded from input file" was an engine bug! So this issue is now fixed for the next release.

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Thu Nov 07, 2024 1:16 pm
by Rseding91
The fixed file. Although it will keep getting broken until the fixed version is released. The trigger to break it is: change the force of a character entity from one that does not have logistics unlocked to one that does.

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Fri Nov 08, 2024 6:48 am
by Olipro
Good to hear, as a C++ dev myself, my first thought was that it'd be a race condition, turns out it's simpler than that! Glad you found it.

Many thanks for the fixed save!

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Fri Nov 08, 2024 2:58 pm
by gansgut
Actually, someone found a reproduction for this here viewtopic.php?f=30&t=120101 In a rare first, "invalid bool loaded from input file" was an engine bug! So this issue is now fixed for the next release.

Thank you for fast reaction! Please fix my save too)

Or how can i fix it by myself?

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Fri Nov 08, 2024 3:42 pm
by Silari
gansgut wrote: Fri Nov 08, 2024 2:58 pm
Actually, someone found a reproduction for this here viewtopic.php?f=30&t=120101 In a rare first, "invalid bool loaded from input file" was an engine bug! So this issue is now fixed for the next release.

Thank you for fast reaction! Please fix my save too)

Or how can i fix it by myself?
From the looks of it it should be fixed automatically if you load it into 2.0.16 which was just released a few minutes ago. The linked report is listed in the changelog. That versions currently experimental so you'd need to opt into the experimental branch of the game if you haven't yet.

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Fri Nov 08, 2024 4:32 pm
by gansgut
Silari wrote: Fri Nov 08, 2024 3:42 pm
gansgut wrote: Fri Nov 08, 2024 2:58 pm
Actually, someone found a reproduction for this here viewtopic.php?f=30&t=120101 In a rare first, "invalid bool loaded from input file" was an engine bug! So this issue is now fixed for the next release.

Thank you for fast reaction! Please fix my save too)

Or how can i fix it by myself?
From the looks of it it should be fixed automatically if you load it into 2.0.16 which was just released a few minutes ago. The linked report is listed in the changelog. That versions currently experimental so you'd need to opt into the experimental branch of the game if you haven't yet.
[2.0.16] experimental

I just uploaded latest beta. In right left corner of the screen i have sign ''2.0.16 (build 80214 expansion, win64)".
Corrupted save doesn't load with same error "Invalid bool loaded from input file. File could be corrupted".

So save wasn't fixed automatically. Or i did something wrong. What can i do next?

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Sun Nov 10, 2024 10:01 pm
by farazsth98
Hey Rseding91,

I'm curious, what tool are you using to inspect the save file data? You said it's compressed into the save, so I'm wondering if there is a way to uncompress the data so I can look at it myself?

Thanks!

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Sun Nov 10, 2024 11:41 pm
by Rseding91
I use the game itself while visual studio's debugger is attached.

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Mon Nov 11, 2024 6:26 am
by farazsth98
Ah right of course haha that makes sense! I just noticed the Factorio PDB is provided right with the executable in the installation directory, so that's nice!

There's a few other instances of this crash in 2.0.16, and they all end up with a stack trace that ends up failing deserialisation through `LogisticsPointFilter::load()`. I haven't personally ran into it but I was trying to see if I could modify whatever byte offset of the save file in order to fix the save file for someone else.

Will try run with a debugger myself and see if I can narrow down what's going on.

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Mon Nov 11, 2024 10:10 am
by BraveCaperCat
Shouldn't this be moved to "Fixed Bugs"?

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Mon Nov 11, 2024 12:03 pm
by gansgut
Corrupted saves doesn't fix automatically.
Silari wrote: Fri Nov 08, 2024 3:42 pm From the looks of it it should be fixed automatically if you load it into 2.0.16 which was just released a few minutes ago. The linked report is listed in the changelog. That versions currently experimental so you'd need to opt into the experimental branch of the game if you haven't yet.
Players still meet this bug also in 2.0.16. Here is latest discussion viewtopic.php?f=7&t=120318&p=637117&hilit=bool#p637117.
BraveCaperCat wrote: Mon Nov 11, 2024 10:10 am Shouldn't this be moved to "Fixed Bugs"?
Why this bug should be moved to fixed ones?

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Mon Nov 11, 2024 12:56 pm
by DomNomNom
@olipro: I've recovered your ship design and attached it as a blueprint string.

Also this is ridiculous lol:
11-12-2024, 01-54-13.png
11-12-2024, 01-54-13.png (5.04 MiB) Viewed 398 times

Re: [2.0.14] Corrupted Save(s) while debugging.

Posted: Mon Nov 11, 2024 1:09 pm
by DomNomNom
@gansgut - here's your save file that I've fixed in the same way I've fixed mine: https://factorio.domnomnom.com/2024-game-test-2 fixed.zip

How I fixed mine: viewtopic.php?p=637305#p637305