+ Start a Discussion

Error: Too many batch retries in the presence of Apex triggers and partial failures

I'm using Data Loader to load in about 300 leads.  I have a trigger that runs before a lead gets inserted that checks to see if the lead exists based on a few fields on the Lead object.   If it does exist, it generates an error using addError().     Some of my data makes it in using Data Loader, but some of it doesn't and generates this error.

How can I load my leads in and avoid this error? 
R Z KhanR Z Khan
Can you post your trigger code? Seems like tis calling batch from trigger
trigger MasterLeadTrigger on Lead (before insert, before update, before delete, after insert, after update, after delete, after undelete) {

	// before 
	if (Trigger.isBefore) {
  	  if (Trigger.isInsert) {
public static void checkDuplicateLeads(list<Lead> leads) {

		map<string,Lead> leadMap = new map<string,Lead>();
		map<string,Lead> leadCompanyMap = new map<string,Lead>();

		for( Lead newLead : leads ) {
			if(newLead.Company != null) {


       for( Lead lead : [SELECT Id, FirstName, LastName,Company 
											FROM Lead 
											WHERE Company in :leadCompanyMap.keyset() 
												]	) {
				if( leadCompanyMap.containsKey(lead.Company)) {
					leadCompanyMap.get(lead.Company).addError('A lead already exists with this information at this company');