Hello! I'm making this as a cross-crash post as It only happens in combination with the mod 'Train construction site'. Maybe it's an incompatibility thing, but neither mods mention this.
Link to the bug report at the other mod: https://mods.factorio.com/mod/trainConstructionSite/discussion/620948d45ceb9bb7a08e57e4
The mod Train construction site (0.2.19) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event trainConstructionSite::on_built_entity (ID 6)
The mod Smarter Trains (5.1.1) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event SmartTrains::on_entity_renamed (ID 58)
SmartTrains/control.lua:1175: attempt to index field '?' (a nil value)
stack traceback:
SmartTrains/control.lua:1175: in function 'decreaseStationCount'
SmartTrains/control.lua:1230: in function <SmartTrains/control.lua:1226>
stack traceback:
[C]: in function 'newindex'
__trainConstructionSite/src/traincontroller.lua:851: in function 'onBuildEntity'
trainConstructionSite/control.lua:67: in function <trainConstructionSite/control.lua:60>