Item With Same Key Has Already Been Added

I am getting an error saying “Item With Same Key Has Already Been Added” even though I initialized the dictionary to a new empty dictionary. This was working just fine yesterday, I added some more work to the sequences, and now it is no longer working correctly. Please help, thanks.

Please upload the workflow :slight_smile:

The workflow is somewhat large and contains secure information dealing with my company. I’m just confused as to why it would work one day and not the next.

You probably wrongly changed the scope of the dictionary.

@jpreziuso

Check in the new sequence Added, Whether u r adding the Duplicate Key to the Dictionary.

Regards,
Mahesh

Same case. Any update ?

Hi,

I don’t know what is your error situation. But I’m getting same error when I use ‘Write Range’ Excel workbook activity. I change it. I use ‘Write Range’ activity in Excel Application Scope. And my problem solved.

Thanks.

2 Likes

This is the way to make it, but not the best. Any ideas about the reason of an error?

Hi Community, even I had faced the same issue that,
Add to dictionary: An item with the same key has already been added.image

Reason: while we are adding Key into dictionary from data table. it will also add the empty rows into dictionary. so that next time is there empty row in the data table it will throw the above exception.(same key already exist or added).

Solution: Before adding key value pair into dictionary, please check the empty rows from datarow and avoid to add into Dictionary.