# Le déplacement d'un post échoue dans des circonstances inconnues

**URL:** https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983
**Category:** Bug
**Created:** [Janvier 14, 2018, 10:01 UTC](https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983 "2018-01-14T10:01:38Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [Janvier 14, 2018, 10:01 UTC](https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983/1 "2018-01-14T10:01:38Z")

</div>

When trying to move a single post into a new topic, it fails with:

```
[db8237] Processing by TopicsController#move_posts as */*
[db8237] Parameters: {"title"=>"importer 3 fichiers", "post_ids"=>["4455"], "category_id"=>"6", "topic_id"=>"1521"}
[db8237] Completed 500 Internal Server Error in 336ms (ActiveRecord: 108.5ms)
[db8237] ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_posts_on_topic_id_and_post_number"
DETAIL: Key (topic_id, post_number)=(1521, 3) already exists.

```

However, that is the post I’m trying to move.

```
db8237=# select id,post_number from posts where topic_id=1521;
  id | post_number 
------+-------------
 4085 | 1
 4151 | 2
 4455 | 3

```

`reindex index index_posts_on_topic_id_and_post_number;` did not help.

Does anyone have any idea where to look? Or did we trigger an obscure bug here?

---

<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: [Janvier 14, 2018, 7:52 UTC](https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983/2 "2018-01-14T19:52:29Z")

</div>

Can you repro this @jomaxro?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [Janvier 26, 2018, 6:47 UTC](https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983/4 "2018-01-26T18:47:31Z")

</div>

Hmm…I’ve moved many posts around in the last 2 weeks without issue. @RGJ, is this site on tests-passed or stable? Is this just a single post with issues, or global? Can you still repro it?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [Janvier 27, 2018, 10:14 UTC](https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983/5 "2018-01-27T22:14:40Z")

</div>

Sorry for the late response.  
It’s on stable, and it’s just a single post (maybe more, but it’s not global). I can still repro it.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [Janvier 28, 2018, 1:49 UTC](https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983/6 "2018-01-28T01:49:25Z")

</div>

If it’s not global I’m not going to be able to reproduce this easily. Perhaps one of the engineers can tell more from the error above.

---

<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: [Janvier 28, 2018, 3:50 UTC](https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983/7 "2018-01-28T03:50:39Z")

</div>

We need a repro @RGJ

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [Janvier 28, 2018, 7:15 UTC](https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983/8 "2018-01-28T07:15:26Z")

</div>

I understand - but we can only repro this on one post on one forum so far.  
I wasn’t expecting an immediate solution, just reporting it for documentation purposes, and maybe getting some advice, or hearing from other people who’re seeing the same issue allowing us to maybe see a common pattern.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [Février 8, 2018, 12:42 UTC](https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983/9 "2018-02-08T12:42:45Z")

</div>

I’ve noticed the same problem with imported posts. They do not always conform to requirements like `min_post_length`. Moving posts triggered those validations and silently prevented the posts from being moved to the target topic. It should be fixed.

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

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [Février 10, 2018, 12:42 UTC](https://meta.discourse.org/t/moving-a-post-fails-in-unknown-circumstances/77983/10 "2018-02-10T12:42:47Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
