# Parent message doesn't exist

**URL:** <https://meta.discourse.org/t/parent-message-doesnt-exist/141746>\
**Category:** Migration\
**Created:** [February 16, 2020, 3:59pm UTC](https://meta.discourse.org/t/parent-message-doesnt-exist/141746 "2020-02-16T15:59:55Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![ruperty](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ruperty/32/164033_2.png) [@ruperty](https://meta.discourse.org/u/ruperty)\
**Post date:** [February 17, 2020, 9:38pm UTC](https://meta.discourse.org/t/parent-message-doesnt-exist/141746/7 "2020-02-17T21:38:32Z")

</div>

Well, I added a couple of print debugs to map\_first\_post

```
def map_first_post(row)
  puts "Mapping parent #{row['msg_id']} #{row['subject'][0..40]}"
  mapped = map_post(row)
  mapped[:category] = category_id_from_imported_category_id(row['category'])
  mapped[:title] = row['subject'].strip[0...255]
  mapped
  puts "Mapped message #{row['msg_id']} #{row['subject'][0..40]}"
end  

def map_reply(row)
  parent = @lookup.topic_lookup_from_imported_post_id(row['in_reply_to'])
  if parent.blank?
    puts "Parent message #{row['in_reply_to']} doesn't exist. Skipping #{row['msg_id']}: #{row['subject'][0..40]}"
    return nil
  end

  mapped = map_post(row)
  mapped[:topic_id] = parent[:topic_id]
  mapped
end

```

These print ok and suggest the parent is mapped (imported?)

873 / 65936 ( 1.3%) [3895 items/min]  
Mapping parent 9205270657.AB03850@ben.dciem.dnd.ca A CALL FOR HELP  
Mapped message 9205270657.AB03850@ben.dciem.dnd.ca A CALL FOR HELP  
874 / 65936 ( 1.3%) [3900 items/min]  
Parent message 9205270657.AB03850@ben.dciem.dnd.ca doesn’t exist. Skipping 9206031720.AA22567@ben.dciem.dnd.ca: A CALL FOR HELP

So, don’t see why the parent is blank in map\_reply. The only thing I note is that the numbers (873/874) are one less than rowid above.

But I don’t think I can go much further as I don’t know what @lookup.topic\_lookup\_from\_imported\_post\_id is doing and it is very laborious to edit with vi and rerun the import, with each cycle taking around 30 minutes.

---

_[View the full topic](https://meta.discourse.org/t/parent-message-doesnt-exist/141746)._
