diff --git a/misc-scripts/stable_id_lookup/populate_stable_id_lookup.pl b/misc-scripts/stable_id_lookup/populate_stable_id_lookup.pl
index 7425b7f50c9d9778702293a0e55940d1b00eef62..dbc9f64094ab8d155e902f46f53c44d92d833d16 100644
--- a/misc-scripts/stable_id_lookup/populate_stable_id_lookup.pl
+++ b/misc-scripts/stable_id_lookup/populate_stable_id_lookup.pl
@@ -368,6 +368,7 @@ sub insert_ids {
           my $status = $tuple_status[$tuple];
           $status = [0, "Skipped"] unless defined $status;
           next unless ref $status;
+          next unless defined $ids[$type];
           printf STDERR "Failed to insert (%s, %s, %s, %s): %s\n",
           $ids[$tuple], $species_id[$tuple], $db_type[$tuple], $object_type[$tuple], $status->[1];
      }