Error: 'Duplicate external id specified' when upsert to Salesforce

One Star

Error: 'Duplicate external id specified' when upsert to Salesforce

Hello everbody
I am working with Talend to load data to SF and I found a puzzling error.
I read data with ODBC and load them to SF with a suitable componente.
I am using upsert with a External ID.
I have several jobs and when testing oe of them I got this error:
java.lang.Exception: Duplicate external id specified: wc000001
at org.talend.salesforce.SforceManagementImpl.upsert(
at gestion_integral___argonauta.step5_0_5.Step5.tDBInput_1Process(
at gestion_integral___argonauta.step5_0_5.Step5.runJobInTOS(
at gestion_integral___argonauta.step5_0_5.Step5.main(

So data was not loaded. The thing is that data is already loaded so Talend should just have to update them, but it didn't.
And the most puzzling for me was that... I deleted that record from Salesforce and after running again the job I got the same error.
I found out if I delete the row from my database (it's a ADS, using ODBC to connect to it) and I created again it worked... but I don't know why, and I don't want to solve it that way... since it could be impossible to solve when data amount is huge!
Why did I get that error?
How could I solve it?
Thanks very much
One Star

Re: Error: 'Duplicate external id specified' when upsert to Salesforce

We are encountering the same issue. Please can you let me know if you found a solution?
Thanks for your time.
One Star

Re: Error: 'Duplicate external id specified' when upsert to Salesforce

Basically it is finding the external Id twice. one quick round about is reducing the batch size to 1. It will run your job but the time taken to complete the job for large data increases significantly
One Star

Re: Error: 'Duplicate external id specified' when upsert to Salesforce

Today I was also facing the same issue
I think the issue is that :
Upsert uses the sObject record's primary key (or the external ID, if specified) to determine whether it should create a new object record or update an existing one:

If the key is not matched, then a new object record is created.
If the key is matched once, then the existing object record is updated.
If the key is matched multiple times, then an error is generated and the object record is neither inserted or updated.

So if  suppose there is already a record present and in datae there are two records to be upserted so
for 1st records condition 2 is fulfilled and it is upserted but when again for updating the second record it becomes condition 3 so the records are not upserted and it throws error


Talend named a Leader.

Get your copy


Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables


How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration



Introduction to Talend Open Studio for Data Integration.