Unable to execute Business Rule. An item with the same key has already been added

janithasundar
New Contributor
Spoiler
 

Summary: Error processing Data Management Step 'App2App_Parallel_Step'.
Unable to execute Business Rule 'App2App_Parallel'. An item with the same key has already been added.

3 REPLIES 3

OS_Pizza
Contributor III

This is probably when you have an existing dictonary key value pair and you are attempting to assign a new key value pair with the same name. You have to explain the entire process and the business rule.

ChristianW
Valued Contributor

The name of your business rule implies, that it runs in parallel. If the dictionary is used in parallel as well (by using globals?), you will run in problems, because the standard dictionary doesn’t support parallel processing.
For parallel processing, you have to us the ConcurrentDictionary (an import System.Collections.Concurrent line is needed).

ConcurrentDictionary has a TryAdd and TryUpdate method to avoid problems from running in parallel.

I hope this helps, for a better understanding of your problem and a more concrete help, we need to know more about the business rule.

RossLikesOS
New Contributor

Adding a little more non-technical answer to the question posed. 

We kept seeing the recurring error "An item with the same key has been added." in our logs and it seemed to be randomly occurring on calculated members in our UD1 dimension.  Several of our UD1 members had api.data.calculate formulas assigned that reference multiple Account.Base ranges.  Turns out that a couple of the account ranges assigned had duplicate base members in their respective ranges.  We had to make sure that if we were pulling account ranges in member formulas, you need to make sure they are all referencing unique base members.