# CardinalityViolation exceptions, database corruption?

**URL:** <https://meta.discourse.org/t/cardinalityviolation-exceptions-database-corruption/140713>\
**Category:** Product Support\
**Tags:** unsupported-install\
**Created:** [February 5, 2020, 11:46am UTC](https://meta.discourse.org/t/cardinalityviolation-exceptions-database-corruption/140713 "2020-02-05T11:46:23Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [February 6, 2020, 12:32am UTC](https://meta.discourse.org/t/cardinalityviolation-exceptions-database-corruption/140713/2 "2020-02-06T00:32:35Z")

</div>

I am guessing here, but the cardinality error is on post\_number, it is meant to be unique by topic. My guess is you have a corrupt index there. I guess a fix could be to find the offending post and renumber it.

> <https://github.com/discourse/discourse/blob/a84c493de2fb4e048f7e642a20050b6eb16383cd/app/models/post.rb#L1147-L1148>

---

_[View the full topic](https://meta.discourse.org/t/cardinalityviolation-exceptions-database-corruption/140713)._
