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.

Let’s disable it by setting the parameter to false and try to deploy again. No luck, the same error has appeared. We need to investigate it more deeply - very quickly you will find that each field contains such prooperty and some of them are set to true. Let’s disable all. And try again. Oh, this mysterious error didn’t disappear yet. We need to search any other properties for history tracking. After thorough search and disabling any property related to history traching we can try to deploy it. Anddd... Error finally has disappeared.

Hope that this article will save a time for you.

[environment][migration tool]