AI-Assisted
By Richard C, AIL Studio
A Salesforce Data Loader insert or update can finish with some rows loaded and others rejected. Those rejected rows land in an error CSV. Salesforce’s Data Loader guide says the tool writes two CSVs whose names begin with success and error. The success file lists loaded rows, including new record IDs. The error file lists rejected rows “with a column that describes why the load failed” (Review Data Loader Output Files).
When the same message appears many times, group by the ERROR text, fix each group once, then reload only the corrected error file. Salesforce Help describes that pattern for a missing required field: open the error CSV, add the value, save, and import the error file again (Fixing Import Errors: REQUIRED_FIELD_MISSING).
The table below is EXAMPLE DATA, not a customer org.
1. Open the error file, not only the success file
In Data Loader, use View Successes / View Errors, or open the CSVs from the folder you chose at Finish (Review Data Loader Output Files). The success file answers how many rows landed. The error file answers which rows did not, and why.
A row that loaded under the wrong Account will not appear here. This step only covers rows Data Loader rejected. If a source column is named success or error, Salesforce notes that output columns can display incorrectly — rename those headers first.
2. EXAMPLE DATA
error_contacts.csv (EXAMPLE DATA)
Data Loader often writes a code, then a longer reason. Group on the repeated prefix, not on a record Id later in the sentence.
| LastName | AccountId | Legacy_Id__c | ERROR | |
|---|---|---|---|---|
| Example | renee@example.invalid | 001000000000001AAA | CT-001 | DUPLICATE_VALUE: duplicate value found: Legacy_Id__c duplicates value on record with id: 003000000000099AAA |
| sam@example.invalid | 001000000000001AAA | CT-002 | REQUIRED_FIELD_MISSING: Required fields are missing: [LastName] | |
| Example | jo@example.invalid | 001000000000999AAA | CT-003 | INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY: insufficient access rights on cross-reference id |
| Example | lee@example.invalid | 001000000000001AAA | CT-001 | DUPLICATE_VALUE: duplicate value found: Legacy_Id__c duplicates value on record with id: 003000000000099AAA |
| kai@example.invalid | 001000000000002AAA | CT-004 | REQUIRED_FIELD_MISSING: Required fields are missing: [LastName] |
Expected groups: two DUPLICATE_VALUE rows, two REQUIRED_FIELD_MISSING rows, and one INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY row. The Ids are fabricated placeholders.
3. Group the ERROR column
On a sheet named Errors, with ERROR in column E, put this in F2 and fill down:
=IF(E2="","",IFERROR(LEFT(E2,FIND(":",E2)-1),E2))
Count each group in G2:
=IF(F2="","",COUNTIF(F:F,F2))
Copy column F, paste values, and remove duplicates to get the unique keys. Filter column F and work one group at a time.
The same extract in Python (standard library only). Change the path to your file. EXAMPLE DATA until then.
import csv
from collections import Counter
def group_key(message):
message = (message or "").strip()
return message.split(":", 1)[0] if message else "(blank)"
with open("error_contacts.csv", newline="", encoding="utf-8") as handle:
rows = list(csv.DictReader(handle))
counts = Counter(group_key(r.get("ERROR")) for r in rows)
for key, n in counts.most_common():
print(n, key)
On the example file this prints 2 DUPLICATE_VALUE, 2 REQUIRED_FIELD_MISSING, and 1 INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY.
If two duplicate-value rows differ only by the Id at the end, text before the first colon still groups them. If there is no colon, search the column for a shared phrase such as duplicate value found.
4. Fix each group from the documented cause
Salesforce Help lists common Data Loader messages with a cause and a fix (Common error messages in Data Loader). Map your groups to that list.
-
DUPLICATE_VALUE/ “Duplicate value found.” Help says this is a duplicate in a field marked Unique. Find that mapped field and change the colliding values. In the example,Legacy_Id__cvalueCT-001appears twice. -
REQUIRED_FIELD_MISSING. Help says a required field was missing or empty. Add the value in the error CSV and import that file again (REQUIRED_FIELD_MISSING). In the example,LastNameis blank. - “Insufficient access rights on cross-reference id.” Help lists typical causes: the referenced record is deleted, never existed (a typo in the Id), or is not shared with the running user or with the owner of the row you are loading. Reduce batch size to 1 while you find the bad Id. Do not invent an Account Id to clear the error.
If most rows already succeeded, do not reload the original full file — you risk duplicates on the success set. Reload the corrected error rows.
5. What grouping does not prove
Rows in the success file can still have a blank or wrong AccountId; they will not show up here. Two different validation-rule messages are different groups even if they feel similar. The error file names a cross-reference failure, not the sharing rule behind it. No Salesforce org was queried for this article. Re-check the steps against your firm’s load rules.
AIL Studio is not affiliated with Salesforce. Salesforce is a trademark of Salesforce, Inc.
If you would rather send Contact and Account exports and get a findings workbook back, AIL Studio offers a $19 Salesforce Export Check: order the $19 check. After you pay, email the exports to madebyailstudio@gmail.com (no passwords or org logins). You will receive a findings workbook; please allow up to 3 business days after we receive a usable export.
Top comments (0)