Overview
When trying to destroy object, you may get the following kind of error message:
Error 2601, Level 14, State 1, Procedure -, Line 1, Message: Cannot insert duplicate key row in object 'dbo.OBJECTTnnnIS' with unique index 'IX_OTnnnIS_EXTIDSTAT_EXTID'. The duplicate key value is (5, X). (ERROR: 50000, SQLSTATE: 42000)
Solution
This is related to a known issue with ID 147176 and it is fixed in M-Files Jun ’24 Update (24.6.13797.6).
There are two objects of the same object type (nnn) with the same external ID (X) in the database and this is causing the issue.
As a workaround, the external ID of the problematic object needs to be changed, it needs to be set to unique value. There are two options to do this:
- with API call SetExternalID: https://www.m-files.com/api/documentation/latest/MFilesAPI~VaultObjectOperations~SetExternalID.html
- OR, the vault database needs to be modified. In this case, please run following SQL queries and save results to csv-files and send those to M-Files Support using CryptShare.
select * from objecttypeitem where extid = 'X'
select * from OBJECTTnnnIS where extid = 'X'
