Sequence: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

Hello UiPathers,

I’m alittle perplexed, I’ve developed an automation that I have no issues running on my development laptop, but as soon as I trigger the job to run on the Bot’s unattended machine I start running into the error: “Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index”

It keeps stopping after the “Element Exist” activity and right at the sequence I have right inside of my “If” activity. I’ve attached a screenshot below for context. I can’t figure out why this is happening when it runs smoothly on my PC. I should note this isn’t the first automation I’ve built and ran on the Bot’s unattended machine.

Thank you all for the help!

hey

looks like you index variable is negative, can you debug and see this variable is returning the correct value?

regards

Hey,
Debugger is showing Index as being 1, which is correct.
image

Hi,

Did you identify which activity throws this exception? If possible can you share workflow and/or properties of the activity?

Regards,

Hey,

I did! I believe it’s the sequence container. On the bot’s unattended machine. I opened up the .xaml file, I disabled the “Sequence”, created a new one and dragged the activities I had in the old disabled “Sequence” into the new “Sequence” container and ran the automation in debug mode, the error stopped… tomorrow I will republish the package and try to run the job from orchestrator. If error doesn’t reoccur, I may have just solved this error. At the moment seems like a bugged “Sequence” container.

1 Like

Hello,

Is it going inside the Sequence or failing in the condition booTrue=True ?

Did you provided enough delay before the Element Exists activity? If you have Studio available in the other machine just try to run it in debug mode using Step Into and see where the error is happening

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.