watchmanmonitor reported a recurring ActiveRecord::RecordNotUnique error when moving posts or approving them, specifically citing a duplicate key violation on the index_topic_users_on_topic_id_and_user_id constraint. Despite upgrading to the latest version and performing a full Docker rebuild, the issue persisted across multiple forums watchmanmonitor. codinghorror initially suggested the issue might be related to post specifics or user permissions within the target category, noting they could not reproduce the error on try.discourse.org. watchmanmonitor provided additional error logs showing the problem occurred even in categories with no restrictions. Suspecting external factors, watchmanmonitor hypothesized that custom PostgreSQL default actions might be the cause. Upon further inquiry from zogstrip, watchmanmonitor revealed they were using custom scripts to set default user watch lists upon creation. The root cause was eventually identified as an auto-watch script that inadvertently double-added watch categories for a specific user, creating the duplicate entry in the database watchmanmonitor. The issue was resolved by updating the watch script to prevent duplicate entries, confirming the problem was not a bug in Discourse itself.
I’ve moved my posts about the errors moving posts to this topic.
I’d call it a bug, but there is a chance that this would be due to the default actions I have in our postgres databases. Those are all user based though… if new user, set some prefs, and add watched categories.
We don’t have anything effecting categories or permissions.
the command ended up double-adding watch categories to one of our users. we’ve updated the watch script to help prevent this.. but it was no issue with discourse proper