It seems when a entity dies, the platforms mod calls the script to refill in the area,
However it first sets the tiles under the entity that just died.
In my case that causes the player near the teleporter (https://mods.factorio.com/mod/Teleporters) to be killed by the set tile action. Killing the player is compeltely unexpected, so naturally my script fails to account for it and errors.
Is there some mechanism you can provide so I can tell your mod not to run the event when my entity dies?