"message": "For each row: Collection was modified; enumeration operation might not execute."

Hi guys, i have a problem with this error

Goals : I want to read all file in the folder, and then every looping file, i will do process looping values inside the current file.

Hi , Run process in debug mode. Please check what value your data table contains and for which file reading data table is throwing this error and also if you can share your files in folder few excel contains it will help to solve this error

i check the log

i need more Specific information sir, im confused


Your activities seems not normal (at least on display). So can you try to upgrade UiPath.System.Activites to 22.4.5 or 22.10.x if you use 22.4.4 or lower?



Which version of Studio do you use? if you use older version, it might be good to use studio bundled activities packages.


Im using version 2019 sir


Is there any reason to use the latest activities package?
Some package doesn’t support older version Studio. For example UiAutomation 22.4.7 doesn’t support Studio 2019 as the following image.

There might be some issue System 22.4.5 in Studio 19.10.

So can you try to use Studio-Bundled activities package such as System-package 19.10.1 etc?


My for each row should be inside for each file? @sanghamitra_nayak

If i use the bundled, Will it interfere the activities that I have made?

HI @gilang_ramadhan123

Do you modify or update the variable “in_DataRow” inside that for each?

Like adding the new item to in_Datarow or delecting or emptying the in_DataRow

This error will be occurs only if you are looping through a string of array and modifiying or deleting the same string of array inside the for each

Let say i am having a string of array variable called “Arr_String”

  • For Each Item in Arr_String
    • assign activity
      Arr_String = {}

This will throw the error because you are currently looping in that string of array after completing the loop the Arr_String will become empty so it is saying collection was modified operation might not execute

Hope this Helps


yes sir, im adding some data row in the excel file


Downgrade activities package might cause invalid activity error. If possible. it might be better to upgrade Studio to 22.4.x if you need to use current project as it is.


and then how to add new row in the current excel @Sudharsan_Ka