Erratically getting "The given key was not present in the dictionary."

Hi Guys,
Have you encountered the error “The given key was not present in the dictionary.” intermittently while the bot is running unattended?
Some facts:
-All configurations and Orchestrator assets were loaded successfully during initialization (no error was thrown).
-The error “The given key was not present in the dictionary.” occurs usually on the last part of the workflow.
-Error occurs intermittently, at least once a month.
-The job runs daily.
-Manually running the job always resolves the issue.

My guess is the memory is getting cleared while the bot is running in the virtual machine causing the configurations to disappeared from its memory. Any thoughts?

I don’t think anyone could provide a concrete answer without knowing the logic of your workflow.

Can you introduce some Trace level log messages into the sequence and run the Job or Robot at a high log level for a few runs in order to help track down why the key is not being created when you expect it to be or why it might have been removed?

Strange behavior but there must be some logical explanation.

I would put log messages in sections of the robot. In these log messages I would output the size of all existing dictionaries that the robot has defined at the moment of the log message. This will allow you to examine the output in Orchestrator.

The moment the exception occurs again you could determine whether the size of the dictionaries matches what it normally is. If any of the dictionaries are related to (business) data or are dynamic in size for whichever reason - you could output the correlated data to a file to analyze it afterward.

From my experience, these types of issues require the analysis of data/metrics and some patience.

Hi, Like what I mentioned it happens only once in a blue moon and has no pattern. Recreating the issue will be difficult. The same package runs every day. Invoking it manually through orchestrator always resolves the issue. I also don’t think this specific issue has to do with the logic (unless am wrong).
2020-03-30_Execution.zip (1.8 KB)

I agree on your thoughts. It is not easy to recreate. I am just curious if my bot is the only one encountering this issue.

My gut feeling pointed to something but I wasn’t sure if you were using the ReFramework. Seeing your execution log now it seems to back that theory up as I am pretty sure you are using the ReFramework. See the following example workflow:

In the example above if an exception occurs in the Get Asset activity, the exception is caught by the Try/Catch block. The execution continues by outputting using the Dictionary’s Dispatcher.LoginURL key yet it does not exist in the Dictionary because the asset could not be retrieved from Orchestrator and therefore could not be set. This will throw an exception as the key is not defined in the dictionary.

You seem to have a similar problem in your execution.
“Loading asset CWT_EmailSubjPrefix failed: A task was canceled.”

You’re using the CWT_EmailSubjPrefix asset further down the line. They’re causing these errors:
“Add Email Subject Prefix: The given key was not present in the dictionary.”
“Invoke CWT_SendSummaryEmail workflow: The given key was not present in the dictionary.”

Reaching Orchestrator is not 100%. Your internet might be down, orchestrator might be down, DNS issues might occur, packets might get lost somewhere along the way. There are so many things that could cause problems in retrieving the asset from Orchestrator. This can happen every now and then. Depending on the process you’re automating, its frequency and how you’ve set up the automation this might be neglectable, or not. It’s up to you (and your team) to decide what the best thing is to do in cases when this happens.

My post was written for a broader audience as people might run into the same issue someday. In your case I would like to ask you if the email’s prefix has to be stored in Orchestrator. If not then simply store it in the configuration file. If so, keep things as it is and discuss internally as to if and what retry mechanism you’ll put in place.

Good luck.

3 Likes

Thanks man. I did not noticed the line that says “Loading asset CWT_EmailSubjPrefix failed: A task was canceled.”. But you were right, it could be due to network interruption while the bot was retrieving Assets from Orchestrator.

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