Salesforce Error: duplicate value found: duplicates value on record with id:

Migration an entire salesforce org from one instance to another is real headache for person who will do it. The main trouble is that during development we create a many relationships and dependencies between app’s components. As a result when you try to migrate it you meet a dependency hell. Today I have to install the old version of application which was frozen a half year ago to developer org (because a fresh dev. org have no any dependency while sandbox have all metadata from Production).

The first step for such kind of migration is creation data model, because of all other components have a dependencies on data model. For this app I have to migrate 46 objects (both standard and custom).

I’m trying to deploy it via Eclipse and got a pretty interesting and fully obfuscated error

Error: objects/Account.object(Account):duplicate value found: <unknown> duplicates value on record with id: <unknown>

A quick investigation in Google provides the answer that the cause is enabled history tracking on object. And as a solution we should disable it on destination org and if it’s not a trouble and can take no more that 1 minute, the second part of the solution not seems such simple and clear. We need to disable a history tracking directly on object. So let’s investigate the object’s metadata file and try to find it.

2014-01-19 12_35_03-Force.com - lams_src_objects_Loan__c.object - EclipseLet’s disable it by setting this parameter to false and try to deploy it. And the same error has appeared. We need to investigate it more deeply. And we found that each field contains such prooperty

2014-01-19 12_41_20-Force.com - lams_src_objects_Account.object - Eclipse

Let’s disable all. And try again. Oh, this mysterious error didn’t disappear. We need to search any other properties for history tracking.

2014-01-19 12_45_52-Force.com - lams_src_objects_Account.object - Eclipse

So, seems that no other property might not to be a reason of troubles. Let’s deploy it.

Yeah! Error has disappeared. Hope that this article will save a time for you.

[environment][migration tool]