When sending continuous REST API PATCH calls to Salesforce using external ID fields (such as uuid__c) that accept only unique values, you may encounter the following error:
"duplicate value found: uuid__c duplicates value on record with id: 00XXXXXXXXXXXXX"
This error occurs even though a PATCH operation is designed to either update an existing record or insert a new one (upsert behavior). The duplicate error appears because of simultaneous or near-simultaneous requests.
Why does this happen?
When multiple requests are sent in rapid succession — for example from Node.js or JavaScript — there is a risk of overlapping requests. If the same record is submitted twice within milliseconds or seconds, the first request may still be in process when the second one arrives. The Salesforce server then identifies the second request as a duplicate and throws the error.
To resolve the duplicate error on PATCH operations, synchronize your REST API requests so that only one request for a given record is in flight at a time.
000383480