I was creating a power pole on top of a ghost using create_entity, and the newly created pole was missing one of the cables the ghost had, causing a disconnection.
Demonstration (sorry the volume is so low): https://www.youtube.com/watch?v=-DDF7EOwERs
It seems to be an issue because the lower cable already has 4 connections and no other power pole can reach the new entity. If another power pole can reach it or the closest power pole isn't almost full, it works as expected. Placing the power pole manually or placing with no ghost works. My wild guess is it's an issue where create_entity creates the entity before destroying the ghost, so it can't use the cable slot the ghost had, but placing manually destroys the ghost first or directly replaces it, so it can use that cable slot.
This is happening on 1.1.82, but I was also able to repro on 1.1.68 as well, so it's not a new issue.
[1.1.82] Power pole connection missing when replacing ghost with create_entity
Re: [1.1.82] Power pole connection missing when replacing ghost with create_entity
Thanks for the report however i am not considering this to be a bug. As you noticed there are already 4 different connections at the electric pole below leaving only a single one cable slot for the ghost. By creating another pole through the create_entity you basically specify a new entity which is created first, fails to connect and then the colliding ghost is removed, even if its the same one. If you want to revive the existing ghost entity you should use LuaEntity::revive on the existing ghost of electric pole. When player is manually building electric poles on top of existing ghosts the game detects that and performs the revive instead. I am not going to change order of any operations involved here.