Formula agent generates error 'Array index out of bounds'

I have a formula agent that generates the following error in the Notes log: AMgr: Agent “Name agent” in “database” did not process all documents successfully. Check the Agent Log for more information: Array index out of bounds.

The code of the agent is:

REM {The salesman has to be reminded after 5 days when the status is Identification (4)};

SELECT Form = “CampaignCustomer” & CCStatusNumber = 4 & @Adjust(DateLastStatusChange;0;0;5;0;0;0) < @Today & IdentificationReminderDate = “” & SalesmanName != “”;

Subj := "Reminder: Campaign " + CampaignDescription + “: " + @UpperCase(CustomerName) + " is in Identification stage.”;

BdyR1 := "Dear Collega, " ;

BdyR2 := "This is an auto created reminder concerning campaign " + CampaignDescription + “: " + @UpperCase(CustomerName) + " is in phase Identification. The opportunity has been created 5 days ago.”;

BdyR3 := “Please qualify the possiblities of the customer asap.”;

BdyR4 := “With kind regards,”;

BdyR5 := “Sender”;

BdyR6 := "Link to the document: ";

@MailSend(SalesmanName;“”;“”;Subj;“”;BdyR1 + @NewLine + @NewLine + BdyR2 + @NewLine + @NewLine + BdyR3 + @NewLine + @NewLine + @NewLine + BdyR4 + @NewLine + @NewLine + BdyR5 + @NewLine + @NewLine + BdyR6 ;[IncludeDoclink]);

FIELD IdentificationReminderDate := @Today;

Can someone help me the question what the cause is of the errormessage “array index out of bounds”?

Thanks in Advance.

Subject: chunk it

I suggest removing parts of your code in chunks until you can narrow it down to find the chunk that might be causing the error. Was there a point at which it worked then you added some additional code and then it stopped?