User cannot create a new topic and tag it during creation - The tags are not listed

Hey @Moin first I want to thank you for your help, this sql/queries usage is other approach to solve an issue in Discourse that I never tried before.

Finally I could run your query, with the help of AI I modified your query to pass the parameters hard-coded in the query directly to Postgres using pgAdmin4. I found that my problematic tag was duplicated in two tag-groups and both tag-groups have different restrictions settings so it could be one reason for conflict, so now I am keeping the tag in one tag-group. But the problem remains, despite that change regular users TL0 and TL1 can’t see the tag even when those groups are authorized to use the tags.

I have crated several queries gathering more information. I coud identify two others tags that belongs to the same tag-group and in UI look like they have the same settings but with the queires I could identify one difference, in the Database in the tags table the pm_topic_count field of my TAG1 has the number 1 value and the other two tags have 0 (zero).

```
tag_name public_topic_count pm_topic_count
TAG1 0 1
TAG2 0 0
TAG3 0 0
```

Researching what I understand is that it is like a quick counter to know how many times the tag has been used, but it does not make sense because I know it is used more than one time for moderators. I asked to AI and it says:

pm_topic_count:
This one is critical. For TAG1 you found pm_topic_count = 1, while TAG2 and TAG3 = 0.

  • That means TAG1 has at least one private message topic using it.

  • When a tag is primarily used in PMs, Discourse can treat it as “hidden” or “non-discoverable” in category composer UIs for regular users. This aligns exactly with your problem: TAG1 may not appear as available for new topics.

I created a query to list all private messages topics for identification, then I went to my forum and with Admin permissions got the private-message topics using the TAG1 and removed the TAG. Now the issue is solved and regular users can use the TAG again… I hope it continue working as expected (finger crossed).

BTW – After I removed the TAG1 from the private-message topic I checked the database and the field pm_topic_count = 0 for TAG1.

Awesome that you figured that out! I wasn’t aware that tags that have only been used in PMs so far cannot be used by users who are not allowed to tag PMs. If I add the tag to a topic or remove it from all PMs, it becomes available :exploding_head:

Thank you for sharing your experience. Maybe I can add this check to my query :thinking:

If pm_topic_count is greater than zero it is used for at least one PM, and even if your, the next step would be find the topics and remove the tag, it is available to the users that are supposed to access/use the tag.

SELECT id, name, pm_topic_count, public_topic_count, staff_topic_count
FROM tags
WHERE pm_topic_count > 0
ORDER BY pm_topic_count DESC;