# Error 500 when editing the "closed topic" post

**URL:** https://meta.discourse.org/t/error-500-when-editing-the-closed-topic-post/50124
**Category:** Support
**Created:** [14 Settembre 2016, 5:26am UTC](https://meta.discourse.org/t/error-500-when-editing-the-closed-topic-post/50124 "2016-09-14T05:26:10Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![barryvan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/barryvan/32/82635_2.png) [@barryvan](https://meta.discourse.org/u/barryvan)
#### Post date: [14 Settembre 2016, 5:26am UTC](https://meta.discourse.org/t/error-500-when-editing-the-closed-topic-post/50124/1 "2016-09-14T05:26:10Z")

</div>

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:

```plaintext
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'

```

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [14 Settembre 2016, 5:40am UTC](https://meta.discourse.org/t/error-500-when-editing-the-closed-topic-post/50124/2 "2016-09-14T05:40:13Z")

</div>

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](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?

---

<div class="post-metadata">

### Author: ![barryvan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/barryvan/32/82635_2.png) [@barryvan](https://meta.discourse.org/u/barryvan)
#### Post date: [14 Settembre 2016, 5:54am UTC](https://meta.discourse.org/t/error-500-when-editing-the-closed-topic-post/50124/3 "2016-09-14T05:54:44Z")

</div>

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

```markdown
: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?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [14 Settembre 2016, 6:41am UTC](https://meta.discourse.org/t/error-500-when-editing-the-closed-topic-post/50124/4 "2016-09-14T06:41:04Z")

</div>

> [@mpalmer](#):
>
> No errors were reported, and no HTTP responses with a 5xx status code are in the logs for try.

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

---

<div class="post-metadata">

### Author: ![barryvan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/barryvan/32/82635_2.png) [@barryvan](https://meta.discourse.org/u/barryvan)
#### Post date: [14 Settembre 2016, 8:02am UTC](https://meta.discourse.org/t/error-500-when-editing-the-closed-topic-post/50124/5 "2016-09-14T08:02:55Z")

</div>

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. 🙂

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [14 Settembre 2016, 9:24am UTC](https://meta.discourse.org/t/error-500-when-editing-the-closed-topic-post/50124/6 "2016-09-14T09:24:19Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [14 Settembre 2016, 4:47pm UTC](https://meta.discourse.org/t/error-500-when-editing-the-closed-topic-post/50124/7 "2016-09-14T16:47:38Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [14 Settembre 2016, 9:46pm UTC](https://meta.discourse.org/t/error-500-when-editing-the-closed-topic-post/50124/8 "2016-09-14T21:46:58Z")

</div>


