DUPLICATES_DETECTED in Salesforce: what it means and how to fix it
Short answer: DUPLICATES_DETECTED means an active duplicate rule in the target org compared your record with existing records, found a match, and was set to block the save. The data can be valid; the org just considers it a copy of something it already has, based on that rule's matching logic.
Duplicate management in Salesforce has two parts. Matching rules describe when two records count as the same, and duplicate rules decide what happens when a save matches: allow it, allow it with an alert, or block it. Standard rules for Accounts, Contacts and Leads come active in many orgs. When a blocking rule matches, the API rejects the record:
DUPLICATES_DETECTED: Use one of these records?
The text after the code is the rule's alert message. "Use one of these records?" is the wording on the standard rules, and admins can change it.
Why it happens
- Records that already exist in the target. A sandbox refreshed from production already has the Accounts and Contacts you're trying to copy in.
- Fuzzy matching. Matching rules can compare names, emails, phones and addresses loosely. "Acme Inc" and "ACME, Inc." can match even though no field value is identical.
- Repeats within a load. Records created earlier in the same job become the existing records that later rows match against.
- Cross-object rules. A Lead rule that checks Contacts blocks Leads whose people already exist as Contacts.
- Narrow test data. Generated data drawn from a small pool of company names or email domains matches itself sooner than real data would.
How to fix it
- Find the rule. Review the object's active duplicate rules and the matching rules they use.
- Decide whether the match is real. If the record already exists, update the existing one rather than inserting a second.
- Change the action for loads. Switch the rule's action from Block to Allow, with or without an alert, while the load runs.
- Deactivate in a sandbox. For a one-time load, deactivate the rule and reactivate it when the load finishes.
- Exclude the integration user. Duplicate rules can be limited by conditions, including on the current user, so the load user can be left out.
- Widen generated data so names, emails and phones vary enough not to collide.
How Syntharil handles it
Syntharil classifies DUPLICATES_DETECTED as an org state error. The record isn't malformed; the target org's duplicate settings judged it a copy, so the answer is in that org's configuration. Seeding de-duplicates only fields defined as unique within the job, and doesn't run the target's matching rules, so a rule tuned to fuzzy names or emails can still block generated rows. Syntharil leaves the target's duplicate rules as configured. Rows that hit a blocking rule are reported with Salesforce's message while the rest of the batch is still saved. On delta replication runs, records copied earlier are updated in place, matched by their stored source ID, rather than inserted a second time.
FAQ
Which duplicate rule produced DUPLICATES_DETECTED?
Go to Setup, Duplicate Rules, and review the active rules for the object you loaded. The alert text on each rule is what users see, so a rule whose alert text matches the error message is the likely source.
What's the difference between a duplicate rule and a matching rule?
A matching rule defines how two records are compared, for example fuzzy company name plus city. A duplicate rule says which matching rules to use and whether to allow or block the save when they match.
Can DUPLICATES_DETECTED fire across objects?
Yes. A duplicate rule on Lead can use a matching rule that compares against Contacts, so a new Lead can be blocked by an existing Contact.
Does the duplicate rule header bypass DUPLICATES_DETECTED?
The SOAP and REST APIs accept a duplicate rule header whose allowSave option saves records that only triggered an alert. It doesn't override a rule whose action is Block.