Random Crash during Multicell session

I had a crash in the middle of a multicell session. The full colony consisted of 2 cells. The second cell had grown, and the colony was working towards reproducing. All of a sudden, the game crashed. There was nothing on the screen to suggest the cause. I had just moved away from several cells which were attacking each other with toxins, which were no longer on the screen. Here’s the report:

This is the error:

ERROR: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

I’ve been unable to reproduce the crash. I also don’t have a save from near the crash.

The error seems very likely to have been caused by a multicellular colony despawning where the species was edited to have less cells than what the species had when the colony spawned.

ERROR: Parameter name: index
ERROR:   at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <02071a39c8a34187bdd1f58e4be38764>:0 
ERROR:   at HexLayout`1[T].get_Item (System.Int32 index) [0x00000] in <4b0d1bca78bd4d9aa2a6c70c0177bf93>:0 
ERROR:   at Components.MulticellularGrowthHelpers.OnMulticellularColonyCellLost (Components.MulticellularGrowth& multicellularGrowth, Components.OrganelleContainer& organelleContainer, CompoundBag compoundRefundLocation, DefaultEcs.Entity& colonyEntity, DefaultEcs.Entity& lostCell) [0x00168] in <4b0d1bca78bd4d9aa2a6c70c0177bf93>:0 
ERROR:   at Components.MicrobeColonyHelpers.RemoveFromColony (Components.MicrobeColony& colony, DefaultEcs.Entity& colonyEntity, DefaultEcs.Entity removedMember, DefaultEcs.Command.EntityCommandRecorder recorder) [0x0001a] in <4b0d1bca78bd4d9aa2a6c70c0177bf93>:0 
ERROR:   at Systems.ColonyStatsUpdateSystem.OnEntityDestroyed (DefaultEcs.Entity& entity) [0x000a0] in 

I’ll add a check in the OnMulticellularColonyCellLost method to print an error in this case and skip the logic for storing the lost cell for regrowing later.

1 Like

Do you mean if the colony had been attacked, and a member eaten - something like that?

That’s what the regrowing logic is for. But in the log you gave the colony was destroyed, and as such its members were being removed. The crash was very likely triggered as one of the lost cells tried to find the cell template it was created from, but the index was over the number of cells contained in that species’ body plan now. The most sensible explanation I can think of is just what I said before:

  • That cell colony spawned
  • The species was modified to have less cells in its body plan
  • That colony was despawned
  • The crash happened when one of the removed cells tried to find itself in the species’ bodyplan but the index was higher than what was left in the species. This throws the error about the index parameter being incorrect.

Edit: I made a fix based on that understanding of what happened:

1 Like