English

Error: Violation of PRIMARY KEY constraint [value]. Cannot insert duplicate key in object [value]. The duplicate key value is [value].

Error Message

When managing versioned data with operations such as compress or reconcile/post, the following error message may be returned:

Error:   
Violation of PRIMARY KEY constraint [value]. Cannot insert duplicate key in object [value]. The duplicate key value is [value].

Cause

Inconsistencies discovered between the adds and deletes tables, such as orphaned or duplicate rows in the delta tables or versioned business table. These inconsistencies can be caused by various editing methods, for example, skipping an intermediate version during reconcile/post.

Note:
When reconciling versions, it is recommended to use the Reconcile Order tab in the Geodatabase Administration dialog box. For more information, refer to ArcMap: Recommended reconcile order.

Solution or Workaround

To resolve this issue, identify and repair inconsistencies within the versioned tables, as described below:

Note:
Only a geodatabase administrator has the privileges to run the diagnose and repair tools. Make sure to take a database backup and that no one is editing in the geodatabase before running the repair. 
  1. Run the Diagnose Version Tables. This tool produces logs that identify the feature class version tables with inconsistencies.
    1. In Catalog, navigate to System Toolboxes > Data Management Tools > Geodatabase Administration > Diagnose Version Tables
    2. In the Diagnose Version Tables window, assign the desired input database connection and the diagnose version tables log location, and click OK.
  2. Run the Repair Version Tables tool to address any inconsistencies from Step 1.
    1. In Catalog, navigate to System Toolboxes > Data Management Tools > Geodatabase Administration > Repair Version Tables.
    2. In the Repair Versions Tables window, assign the desired input database connection and the repair versions tables log, and click OK.
Note:
Refer to the help documents for additional parameters to the tool. Links are listed below. 

Related Information