Error 500 when editing the "closed topic" post

I just closed a topic, but meant to post a message explaining why before. I figured I’d edit the “closed topic” post to do so – but when I hit “save”, I received an error 500. It does seem to have persisted my changes, though.

Looking through the logs, I think that the relevant entry is:

ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "unique_post_links"
DETAIL:  Key (topic_id, post_id, url)=(60, 791, /c/17-q-a) already exists.
: INSERT INTO "topic_links" ("post_id", "user_id", "topic_id", "url", "domain", "internal", "created_at", "updated_at") VALUES (791, 1, 60, '/c/17-q-a', 'community.seqta.com.au', 't', '2016-09-14 05:25:43.149457', '2016-09-14 05:25:43.149457') RETURNING "id")
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:93:in `exec'

I just tried reproducing this on try.discourse.org, and couldn’t. Here’s exactly what I did:

  • Signed up as a new user
  • Created a new topic (https://try.discourse.org/t/this-is-a-test-topic/455)
  • Made myself an admin (since new users can’t close topics), via rake admin:create (rank hath its privileges)
  • Reloaded the topic page
  • Closed the topic via the newly-appeared wrench on the right
  • Clicked the “Edit” pencil on the right hand side of the “Closed 1 min ago” post
  • Put some text in
  • Clicked “Save”

No errors were reported, and no HTTP responses with a 5xx status code are in the logs for try.

What steps did you do differently to make the problem happen?

إعجاب واحد (1)

I’m not 100% sure. :confused: The log entry does reference a different category, and I did have category references in my topic – the exact text was:

:champagne: We've now shipped our :books: LearningField integration! I'll close this topic so that the voters get their votes back.

If you have feedback on this work, it'd be great if you shared it -- ask questions in #q-a, make more suggestions in #suggestions, and help others get up to speed with LearningField in #how-to. Let everyone know how you're using it in #in-the-classroom.

Could it be the category references causing the issue?

I just did similar for both a Closed topic and an Archived topic on my localhost install.

I tried with both an emoji and a link to another public topic.

No repro. for me either time.

I did not try using the bottom Admin wrench

إعجاب واحد (1)

Hmm, that’s very odd. Seeing as everything appears to be working as it should now, I’m happy to write this one off as a random fluke. :slight_smile:

I wonder if I close this topic, then edit the close post, if it’ll explode on me… :grinning:

إعجاب واحد (1)

I don’t remember any of the details, but there was a type of conflict problem before (since fixed) that happened when the editor was open in both a Profile and a Topic at the same time.

I tried to force an error by opening a reply in a topic, minimizing the editor, then going to and editing the Close small action post. - no repro

Might you have had the editor open elsewhere at the same time?

إعجاب واحد (1)