Managed to trigger it again with this just before the if:
log(serpent.line(turret_data))
This is the result:
{pickup_entity = {__self = "userdata"}, stack = {__self = "userdata"}, targets = {[4323463] = {__self = "userdata"}}, turret = {__self = "userdata"}}
{pickup_entity = {__self = "userdata"}, stack = {__self = "userdata"}, targets = {[4323463] = {__self = "userdata"}}, turret = {__self = "userdata"}}
{pickup_entity = {__self = "userdata"}, stack = {__self = "userdata"}, targets = {}, turret = {__self = "userdata"}}