How to repair old titles?

It’s failing to set the topic’s acting_user because @topic is nil.

You could try the following Data Explorer query to find the problematic posts.

SELECT *
FROM posts
WHERE NOT EXISTS(
    SELECT 1
    FROM topics
    WHERE posts.topic_id = topics.id
)

Anyway, I changed the rake task to continue remapping when an error occurs.