Frequently Asked Questions
Frequently Asked Questions: M-Files
"Violation of PRIMARY KEY constraint... Cannot insert duplicate key in object..." errors with unpatched Microsoft SQL Server
Posted by Lassi Lehtinen (M-Files) on 20 September 2018 11:59 AM

If you are using Microsoft SQL Server as the database engine for your M-Files document vault and suddenly many operations in M-Files start to produce errors like

"Violation of PRIMARY KEY constraint.. Cannot insert duplicate key in object..." 

then the first thing to check is your Microsoft SQL Server version.

The most likely reason for the error is that your Microsoft SQL Server version does not include this fix from Microsoft (Sequence object generates duplicate sequence values when SQL Server 2012 or SQL Server 2014 is under memory pressure).

To solve the issue, your SQL Server should be updated with latest updates from Microsoft and M-Files Server service should be restarted afterwards. The nature of this error is such that these operations are often enough to solve it, but not always. Enough retries of the failing operation can make the error disappear at some point but without SQL Server update it is likely to occur again.

In case you have followed the above guidance and the problem still persists, the vault database may need also manual fixes. Please contact support@m-files.com in that case.

(6 vote(s))
This article was helpful
This article was not helpful

Help Desk Software by Kayako case