Object reference not set to an instance of an object INVOICE PROCESSING

Object reference not set to an instance of an object. Exception Type: System.NullReferenceException RemoteException wrapping System.NullReferenceException: Object reference not set to an instance of an object. at UiPath.Core.Activities.ForEach1.InternalExecute(NativeActivityContext context, IEnumerator valueEnumerator) at UiPath.Core.Activities.ForEach1.GetStateAndExecute(NativeActivityContext context, ActivityInstance completedInstance) at System.Activities.Runtime.ActivityCompletionCallbackWrapper.Invoke(NativeActivityContext context, ActivityInstance completedInstance) at System.Activities.Runtime.CompletionCallbackWrapper.CompletionWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

this error come in for each loop when I build invoice processing process . 1st invoice is executed successfully but error come in iteration 2 of for each loop. please help ASAP

@gpal Can you show a Screenshot of how you have used the For Each loop in the workflow ?

here the pic

@gpal The documents variable is an array of Strings that contains the full Path of the documents? Can you Debug and show the Error that has occurred at the 2nd Iteration? If the Error is Indicating the For Each Loop, then try to Comment the whole Body part of For Loop and Check if the Error Still appears while Executing the workflow.

yes the documents variable is an array of string which contain the path of of 4 invoice.
I also debug the workflow and its throw an error like :

error

as you suggest i comment out the body in for each loop. its executed perfectly with no error.

it is the debug result ,…

@gpal Are you by any chance modifying the item variable ? Did you provide a index value to For Each?

If the For Each executed properly by commenting the body that would mean, the Body is affecting the For Each Loop. Either you may be modifying the item variable or the documents variable in the body.

Are you performing any kind of operation related to it ?

no i am not

image

this process is working fine when i am using present validation station

but error thrown when i use action center

@gpal As far I understand there may be limitations when you use the Action Center with a For Each loop. Using a Parallel For Each Loop may be able to Solve the issue.

1 Like

i will try it and come back to you. please keep connect

1 Like

Hi,

Got solution for this issue?

Regards,
Arpitha