If you change your code like below, at least it allows you to remove an invisible light by placing another pole at the same place and removing it, if you created an invisible light by accident.
function MinedEntity(event)
local entity = event.entity
if entity.type == "electric-pole" and string.find(entity.name, "lighted-") then
local found = entity.surface.find_entities_filtered {
name = 'hidden-small-lamp',
position = entity.position,
}
--FIX---------------------------
for _, hidden in pairs(found) do
hidden.destroy()
end
--FIX---------------------------
--if found[1] then
--log("removing hidden lamp of "..entity.name.." at "..entity.position.x..","..entity.position.y )
--found[1].destroy()
--end
end
end