I am getting the error of Unique constraint violation found when placing an order in the Magento 2.

When I checked the log file it shows like this -> main.INFO: Reference to undeclared plugin with name 'stockedProductsFilterPlugin'. [] [].

I followed this article to solve this :


It worked for the first time but after that, it again shows Unique constraint violation found. Please help me to solve this.

enter image description here


3 Answers 3


I have fetched same issue after migration. May be the issue related sequence table in database.

Update sequence_order_0 and sequence_order_1 table, set primary key sequence_value and insert two or three number entry.

  • I tried your solution but it's not resolved, Can you guide me
    – huykon225
    Mar 23, 2021 at 15:19
  • Check your all sequence table. "sequence_order_0" , "sequence_order_1", In that table sequence_value must be defined autoincrment primary key.
    – S.P
    Mar 24, 2021 at 5:45
  • I make it all about 24 table of sequence_order_ but still error :(
    – huykon225
    Mar 24, 2021 at 8:09
  • First execute reindex command, clean cache, Remove cart item and add to cart product. And check again
    – S.P
    Mar 24, 2021 at 9:09
  • add two to three values in sequence_order_0, and sequence_order_1 table.
    – S.P
    Mar 24, 2021 at 9:10

Check your sequence_order_XX table AUTO_INCREMENT value. I've had some orders in sales_order table already. After updating the sequence_order_XX AUTO_INCREMENT value problem disappeared.


The problem is that my DB is not properly imported. There is some broken reference in that. I fixed it and it is working fine now.

  • I also have problem in db while moving website to another domain. Some table lost primary key. How to solve this issue? Sep 1, 2020 at 15:24
  • @Kowsigan can you share me the way to fix this?
    – huykon225
    Mar 23, 2021 at 9:17
  • 1
    this doesnt seem to be an answer - just a status update Sep 30, 2021 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.