<{{Subtitle_Weight}} class="prominent-subhead {{Show_Subtitle}}"> {{Header_Subtitle}}

Executing Swagger Rest SmartObjects: "An item with the same key has already been added Source: SourceCode.HostServer.Lib" error when executing the REST Service Instance Broker SmartObject

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.


An item with the same key has already added. Source: SourceCode.HostServer.Lib error is raised when executing the REST Service Instance Broker SmartObject:



This error is raised due to an incorrect configuration on the Swagger json file

For example (Duplicate entries):


Troubleshooting Steps

Do a comparison of the working Swagger json file and the non-working Swagger json file and you will notice that there are duplicate or incorrect values specified.

To correct this:

- Rename the duplicate entries or change your Swagger json file as needed.

- Then navigate back to the SmartObject Tester Tool and refresh the REST Service instance & SmartObjects.

Note this comparison can be done with Win Merge or Beyond Compare to validate if there are any inconsistencies on the json file.