Page 1 of 1

[1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Mon Jan 16, 2023 11:34 am
by eskaa
My game crashes regularly during saving (including auto saving). The save progress stops at around 30% and the crash notification pops up.

This started happening a few days ago and I have no idea what causes this.

I'm running a lot of mods because it's an SE run. All mods are up to date.

Crash dump attached.

Let me know if you need more information.

Thank you very much!

Edit: I wanted to add that the first time this happened I installed https://mods.factorio.com/mod/kry-inserters and https://mods.factorio.com/mod/factoryplanner

The game doesn't crash during every session. Sometimes I can play for 30 minutes before it crashes again during an auto or manual save.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Mon Jan 16, 2023 1:30 pm
by Loewchen
Post the latest save please, see 3638.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Mon Jan 16, 2023 1:34 pm
by eskaa
Added to original comment. Sorry.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Mon Jan 16, 2023 3:45 pm
by Rseding91
Do you have any series of steps to take a known working save file, perform those steps, and produce this crash? One that happens every time without needing to "wait for 5/10 minutes" (a wait is fine, but it needs to be exact and happen every time)?

I've seen this crash before; but only in systems where people were poking at Factorio memory with external tools or in systems with unstable hardware.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Mon Jan 16, 2023 4:56 pm
by eskaa
Do you have any series of steps to take a known working save file, perform those steps, and produce this crash?
Not at this moment, sorry. Unfortunately the game hasn't crashed in the last few hours so I can't reproduce it right now. I didn't change anything in terms of mods or settings though. Over the weekend it crashed constantly.

However, I did turn off Steam Cloud today because after a crash I would have trouble restarting the game. Steam would take forever synchronizing so I disabled this feature.
[..] but only in systems where people were poking at Factorio memory with external tools or in systems with unstable hardware.
My system very rarely crashes. Also not using any tools to harm Factorio in any way.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Tue Jan 17, 2023 5:17 pm
by FuryoftheStars
eskaa wrote:
Mon Jan 16, 2023 4:56 pm
[..] but only in systems where people were poking at Factorio memory with external tools or in systems with unstable hardware.
My system very rarely crashes. Also not using any tools to harm Factorio in any way.
Even "rare" crashes could be signs of an issue. Ideally, your system should never be crashing (for example, mine hasn't crashed in at least a couple of years since the last reformat, not including the power-offs from overheating that I solved several months back). Crashes from drivers are fixable by updating (or in the case of new drivers causing the crash, rolling back), but if you've checked out all of the drivers and they're good, then that leaves hardware. Crashes due to hardware are because of data corruption that happened to hit a critical piece of data that the system couldn't recover from. A small enough of an issue could thus only rarely cause issues.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Tue Jan 17, 2023 8:19 pm
by eskaa
Thank you. I wasn't very clear in my comment, apologies.

In terms of blue screen or hard reboot my system hasn't crashed a single time since I build it in early 2021. Even did an overnight memtest at some point because of some XMP issues I have fixed. All drivers are up to date.

Applications crash very rarely crash. Maybe once every six months. Factorio has never crashed before.

It all started with the aforementioned mods and me tinkering around with the LUA. Though I have deleted my edited mods and reinstalled them (which is why I didn't mention this before).

Crash happened twice today during auto save. Played for 8 hours in total. Can't reproduce it.

Maybe a clean install could help?

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Tue Jan 17, 2023 8:30 pm
by FuryoftheStars
Have you tested with other saves/new game? I believe this is a data corruption with the save itself, not the game.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Tue Jan 17, 2023 9:21 pm
by eskaa
I have not. Mainly because I went 6 hours today without a single crash playing SE. So playing a different world to see if the crash happens again could take a long time. I'm performing a clean install of every mod to see if I messed up something.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Tue Jan 17, 2023 10:17 pm
by FuryoftheStars
Ah, ok, I was interpreting this as it was consistently crashing on save attempt of this particular save/map.

If it was working previously and there have been no changes to the mods aside from your tinkering with them, then that likely may be why.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Sat Jan 21, 2023 3:36 pm
by eskaa
No crashes since I re-installed all mods. Maybe I actually caused this myself? :(

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Sat Jan 21, 2023 7:46 pm
by eskaa
Hi all, I'm back with the crash. I was messing around in the editor when it happened but now I'm able to reproduce it.

Logs are from two separate reproductions with the attached save file. Video how I'm able to reproduce it here: https://youtu.be/9uwc4RSLRAc?t=45

Thank you!

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Sat Jan 21, 2023 7:58 pm
by Tertius
The video is private. Please set it to unlisted to make it available for everyone but not appear in searches.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Sat Jan 21, 2023 8:02 pm
by eskaa
Done

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Sat Jan 21, 2023 10:06 pm
by Rseding91
Thanks for the save and steps to reproduce the issue. IT looks like you have an item request proxy (the blue triangle) requesting a item with a count of 0. Do you know if that was created from a blueprint string online? Did someone modify the blueprint string externally?

I've fixed it for the next release so the game will ignore 0-count entries in blueprint strings and error in other places where it might attempt to create a 0-count item stack. In the meantime you can fix your issue by removing those specific item request proxies.

Re: [1.1.76] Crash on saving: "Trying to save item stack with non zero itemID and zero count"

Posted: Sat Jan 21, 2023 10:44 pm
by eskaa
First off: Wow. Did you really just identify and fix the issue in less than 3 hours on a Saturday night? Thank you so much!
Do you know if that was created from a blueprint string online?
It wasn't.
Did someone modify the blueprint string externally?
No. I probably caused this.

The blue triangle requests Transport Drones for a Requester Depot of the mod https://mods.factorio.com/mod/Transport_Drones.

When you place a Requester Depot as a single entity it's empty and not requesting anything.

I first saw the blue triangle requesting Transport Drones when I copy + pasted things around (including blue prints) while switching between the map editor (through console /editor) and my normal game.

At some point I first saw these blue triangles and just removed them. Didn't think much of it but your explanation makes perfect sense.

Again, thank you very much!

Edit: Nvm, just saw this. https://mods.factorio.com/mod/Transport ... 1a7d07da2 Someone requested this as a feature to behave similar to the Module Inserter mod... thanks again :)