The mod Space Trains (1.3.4) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event Space_trains::on_tick (ID 0) Space_trains/control.lua:196: attempt to index field 'train' (a nil value)
stack traceback: Space_trains/control.lua:196: in function <Space_trains/control.lua:194>
Traced it back to a cause. If a locomotive to locomotive collision would cause one of them to be destroyed, then the attempts to reverse the damage won't have any effect and it will still be destroyed, and next tick, there will no longer be a valid entity to connect.
The mod Space Trains (1.3.5) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event Space_trains::on_entity_damaged (ID 103) Space_trains/control.lua:190: attempt to compare number with nil
stack traceback: Space_trains/control.lua:190: in function <Space_trains/control.lua:182>
I just found out control.lua might be completely redundant.
I was working on my fork that makes trains smaller and I ran into similar issue as well.
Removing it for some reason removed the crash for some reason?
well, because control.lua is used to bypass an engine limitation that has to do with connection distances, and is necessary unless you want to couple every piece of rollingstock manually
The bug I think can happen as a result of not having built anything since updating the mod from an earlier version, and causing two locomotives to collide by any means, since the Valid_build variable is not initialized until at least one entity is built since mod update.