Excel template - The given key was not present in the dictionary

I’ve been using a UiPath Robot (Attended Named User) for over 3 years to update inventory in an ERP system. The robot retrieves data from an Excel file as input and runs 24/7. It updates the status in the Excel file as Success or Failed after each attempt. Recently, the robot encountered an error message ‘The given key was not present in the dictionary’ when updating the Excel file, and I’m not sure how to fix it. I’ve tried restarting the virtual machine, repairing Microsoft Office, deleting temporary files, and using a fresh Excel template, but nothing works. Can anyone please advise on how to solve this issue?

Hey @jalipinjuanis ,

If any config file is being used inside the process, some one has deleted the key from the config file hence you are facing this issue. There is no issue with ms office or machine this is code issue.


1 Like

Hi @jalipinjuanis ,

This would mostly point out to a Dictionary variable maybe Config which is used widely, Maybe there were some changes in the Config file or changes in the Orchestrator Asset names that might have made the key not available and thus the error.

Are you able to Debug the Process from Studio, You will be able to understand which variable or at which step the error happens and also can get the key that was used so that you can cross check with the respective files or asset names.

1 Like

@Sanjit_Pal Yes I am using config file. I will try to use new config file and see if the problem persist. Thank you.

@supermanPunch, I did run the process from Studio but strangely I did not encountered the issue. However, I am using different config file because the config file is located in the local VM. So the Studio and Robot is actually using two different config file. Maybe there is something is wrong with the config file in the Robot VM. I will check it out.

Thank you for your advise.

1 Like

Hi @Sanjit_Pal , @supermanPunch,

Replacing the Config file with fresh template seems to work but after some time this error will occur again even the Config file was not touched by anyone. So this is intermittent issue. What should I do? Is replacing the Config file periodically will prevent the error?