35

When I try to redeploy an object that exists in source and destination orgs, the deploy fails with the cryptic and useless error message:

duplicate value found <unknown> duplicates value on record with id: <unknown>

This fails whether I deploy with Migration Tool or IDE. Note, individual fields are deployable, but not the object.

  • 1
    Figured out the problem. Some Salesforce issue with History tracking was the root cause. Turned off history tracking in dest org and once the history object was eliminated, the object could once again be deployed. Not sure why there was an issue, though the object label was changed in the source org. I think SFDC was trying to recreate the History Object during the object deploy. I would have to say there's an underlying Salesforce Bug that should be resolved here, but a 2 minute workaround is better than the full day lost having to go through their support process. – DaveS – Mohith Shrivastava Jan 8 '13 at 18:48
  • You can go ahead and make this answer and self make it correct so it helps others.Thanks – Mohith Shrivastava Jan 8 '13 at 18:49
29

Editor's Note: This issue has been resolved in Winter 19


Figured out the problem. Some Salesforce issue with History tracking was the root cause. Turned off history tracking in dest org and once the history object was eliminated, the object could once again be deployed.

Not sure why there was an issue, though the object label was changed in the source org. I think SFDC was trying to recreate the History Object during the object deploy. I would have to say there's an underlying Salesforce Bug that should be resolved here, but a 2 minute workaround is better than the full day lost having to go through their support process.

  • Please accept your own answer then so it goes off the radar ;) We need to keep the statistics nice so this site leaves beta stage sooner :P Now back to the issue... I had error like that when SVN messed up Profile file merge and I got 2 times an entry about same field. Never heard about it having anything to do with Histories, good to know. – eyescream Jan 9 '13 at 19:46
  • 1
    I have to wait 19 hours before I can accept my own answer (grrrr). On the issue, this can also happen if a RecordType that exists in both orgs has the label (but not the api name) changed in the source org. – DaveS Jan 9 '13 at 23:28
  • 3
    Still getting this bug. Did anyone log a case? – Jeremy Ross May 1 '14 at 17:47
  • 2
    Please also provide the steps in how to turn off history tracking. – JWiley Jun 26 '15 at 15:35
  • I was about to lose my ever flippin' mind. Thank you! Disabling history tracking on the object let me deploy the object. – Doug Ayers Nov 7 '15 at 3:04
3

Another possibility, for others that may encounter that error message, is listed on the DreamFactory Wiki:

Description: Found when you push Record Types and another Record Type with the same API name but different Label exists on the destination.

Workaround: Execute a Compare Asset and ensure that the Labels and API names match on both sides.

3

Removing the history tracking in the destination org didn't resolve this for me. Performing a find and replace on the object's XML file for History>true to History>false did the trick. All of the <trackHistory> and <recordTypeTrackHistory> needed to be set to false in the objects XML file. Don't forget the <recordTypeTrackHistory> I missed it on the first pass.

  • My issue was due to the recordTypeTrackHistory, however you don't have to set it to false in the xml file. The other way is to set the history tracking on the record type in the destination org. (if the object and record type is already there) – Nick Cook Jan 25 '17 at 1:47
2

The above error is triggered in the database layer due to unique constraint on the object's field and can also be caused by a trigger or workflow; to track it down do the following (based on Duplicate value found: duplicates value on record with id: <unknown>.):

  1. Find unique field api names on the object by downloading the src/objects metadata information and searching for <unique>

  2. Search within src/workflows and src/triggers metadata for where these fields are referenced.

  3. Examine the code and figure out which unique field is being populated and how and in effect understand how the 'duplicate value found error' is being triggered.

enter image description here

  • We encountered this when trying to set a unique field via a workflow. Tests would fail about 20% of the time when we inserted records that used this workflow rule. Changing to a before insert before update trigger fixed the problem for us. – Dan Watt Jan 21 '15 at 19:34
1

Known issue : Deployment fails with duplicate value found: duplicates value on record with id: error

This has been fixed in Winter '19

I hope this might help : If you are facing this error for page layouts, here is the best workaround !

Workaround Solution :

  1. Quick Actions for either salesforce classic or lightning, buttons on related lists may be showing duplicates, which should not be. (Observe the entire page layout for duplicates)
  2. Removing them and saving from the source environment doesn't work (duplicates re appear after saving).
  3. Retrieve via ant and edit retrieved page layout file to eliminate duplicates manually.
  4. Deploy the retrieved & modified file from your local to Target environment.

    Known issue : Deployment fails with duplicate value found

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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