Index was outside the bounds of the array uipath + folder as per subject name

Hi,

I received mail with a fix subject template. Example: Invoice_XYZ Company. I want to move the invoice in the company-specific folder. In case there isn’t the company specific folder, the folder should be created and the invoice should be updated in the folder.

I am getting Index was outside the bounds of the array error. Could you please help how can I resolve the issue?

looks like the folderName is empty, your error appear when you try to split a null value, or a invalid position, so print before your variable and check if it’s working