How to repair old titles?

Your screenshot gives the impression that only “About the category” topics are affected. Did you delete them at some point in time? I just gave it a try and it looks like deleting those topics isn’t possible anymore. Maybe it was in the past and there was a bug…

If you really want those posts gone, you could delete them in the Rails console (rails c inside the Docker container). This should work:

Post.where("NOT EXISTS (SELECT 1 FROM topics WHERE posts.topic_id = topics.id)").delete_all

No, it’s definitely not a problem with the rake task. The referenced topic IDs simply do not exist anymore.