Phantom topics in category - can't delete them (nor the category)

I have a category that I can’t seem to get rid of.

If I go into it all that there is the “About this category” topic (which cannot be deleted but which should not prevent the category being deleted).


However if I try to delete the category, it warns me that there is a topic count of 4 so it cannot be deleted. this corresponds with the topic count shown in the Categories list:


Could you advise what these 4 topics might be and how I might delete them so that I can get rid of this topic. I can’t re-use it because the topic count is wrong… so it needs deleting.

It’s possible that topics from that category were converted to private messages and got caught by this (now fixed) bug: Unable to delete category if one or more topics are transformed into PM.

If you have access to the rails console, you could try looking for the topics with something like this. Replace ‘your cat name’ with your category’s name, and your_category_id with the id that’s returned from the first query.

Get the category id:

Category.where(name: 'your cat name').pluck(:id)

Use the id to search for any topics:

Topic.where(category_id: your_category_id)

If any topics are returned, have a look at the archetype property of the returned topics. It’s best to not do anything destructive through the rails console if it can be avoided, so try searching for any returned topics on your site with the id of any of the returned topics. For example:


Thank you. I shall give that method a try and report back.