This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.

Issue

When accessing the K2 Application on a SharePoint List or Library, a error is displayed:

"An item with the same key has already been added"

Image

Symptoms

The issue will be encountered when renaming a SharePoint List or Library, and changing the List or Library columns at the same time.

After performing the above, the following prompts will be displayed on the K2 Application:

Image

When performing the "Regenerate SmartObjects and regenerate Views and Forms", some content will disappear from the K2 Application. 

Image

When then performing the "Rename SmartObjects, Views and Forms" action, the error will be encountered.

Resolution

The issue is caused because the Regenerate Action creates the content in a category matching the new List/Library name. When performing the Rename Action, the original category is also renamed to the new List/Library name, causing duplicate Categories.

This can be observed in K2 Designer and the same error will be encountered:
Image

To resolve the issue, the duplicate category will need to be deleted in K2 Designer.

The category containing no content is considered the duplicate and is the one that needs to be deleted.

This is a known issue when Renaming a SharePoint List/Library and then regenerating artifacts on a SharePoint List/Library. The issue is currently with the developers to be addressed in a future update for K2.

To avoid this issue, it is suggested to first change the List/Library columns and then regenerate the Artifacts from the K2 Application Page.
Once that is completed, rename the List/Library and then rename the artifacts from the K2 Application Page.