# 正文与您之前发布的内容过于相似——即使之前的帖子并未成功发送

**URL:** <https://meta.discourse.org/t/body-is-too-similar-to-what-you-previously-posted-even-when-previous-post-didnt-go-through/105436>\
**Category:** Bug\
**Created:** [2019年一月2日 01:00 UTC](https://meta.discourse.org/t/body-is-too-similar-to-what-you-previously-posted-even-when-previous-post-didnt-go-through/105436 "2019-01-02T01:00:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanblue](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@seanblue](https://meta.discourse.org/u/seanblue)\
**Post date:** [2019年一月2日 01:00 UTC](https://meta.discourse.org/t/body-is-too-similar-to-what-you-previously-posted-even-when-previous-post-didnt-go-through/105436/1 "2019-01-02T01:00:36Z")

</div>

There are times when you try to post in a topic, only to get some kind of server error (usually just with a generic “internal server error” message). The problem is, when you try again, you get that “body is too similar” error message instead, and you can’t post without changing the body of your message. Considering that the original message didn’t go through, I don’t think you should get the “body is too similar” error.

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2019年一月2日 01:49 UTC](https://meta.discourse.org/t/body-is-too-similar-to-what-you-previously-posted-even-when-previous-post-didnt-go-through/105436/2 "2019-01-02T01:49:31Z")

</div>

This is legit:

> <https://github.com/discourse/discourse/blob/a19170a4c2c37bb6f6ae9531fe4f925777f3e8d5/lib/post_creator.rb#L170-L170>

We store the key in redis a bit too early which means that a whole slew of errors can mean we never roll back the redis key.

Additionally, looking at post creator there are conditions where it can raise and then this line never hits:

> <https://github.com/discourse/discourse/blob/a19170a4c2c37bb6f6ae9531fe4f925777f3e8d5/lib/post_creator.rb#L185-L185>

So rolling back this redis set is a bit tricky cause we need to do it for 2 types of conditions (general error OR errors are not blank and the error is not the too similar one)

Additionally this does raise the point on review that #create can technically raise an exception which is a bit inconsistent.

@tgxworld can you add cleaning this up to your list?

---

<div class="post-metadata">

**Author:** ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)\
**Post date:** [2019年一月8日 06:48 UTC](https://meta.discourse.org/t/body-is-too-similar-to-what-you-previously-posted-even-when-previous-post-didnt-go-through/105436/3 "2019-01-08T06:48:24Z")

</div>

I don’t think we need to handle the rolling back of the Redis key at all. We just have to set the redis key outside of the transaction when the post has been saved successfully.

---

<div class="post-metadata">

**Author:** ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)\
**Post date:** [2019年一月8日 07:27 UTC](https://meta.discourse.org/t/body-is-too-similar-to-what-you-previously-posted-even-when-previous-post-didnt-go-through/105436/4 "2019-01-08T07:27:12Z")

</div>

The issue described in this topic is fixed in

[https://github.com/discourse/discourse/commit/ec27db78bec4b50a475a5dd830bc0d695bfe66cd](https://github.com/discourse/discourse/commit/ec27db78bec4b50a475a5dd830bc0d695bfe66cd)

@seanblue If possible, can you provide me with the backtrace of the log when you encounter the “internal server error”?

---

<div class="post-metadata">

**Author:** ![seanblue](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@seanblue](https://meta.discourse.org/u/seanblue)\
**Post date:** [2019年一月8日 11:58 UTC](https://meta.discourse.org/t/body-is-too-similar-to-what-you-previously-posted-even-when-previous-post-didnt-go-through/105436/5 "2019-01-08T11:58:27Z")

</div>

I’m not sure I understand the question. What do you mean by “backtrace of the log”?

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2019年二月19日 04:47 UTC](https://meta.discourse.org/t/body-is-too-similar-to-what-you-previously-posted-even-when-previous-post-didnt-go-through/105436/7 "2019-02-19T04:47:49Z")

</div>


