Monday, October 30, 2006

Error message "An item with the same key has already been added" after installing MOSS2007 Beta 2 Technical Refresh

When you get the error message when loading any from using Forms Services (custom created form or default workflows) "An item with the same key has already been added" the solution is quite simple.

Error: An item with the same key has already been added.


System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. TokenizedNameTable..ctor(EnhancedBinaryReader reader)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. Solution.<>c__DisplayClass8.b__7()
at Microsoft.Office.Server.Diagnostics. FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.Server.Diagnostics. ULS.SendWatsonOnExceptionTag(ULSTagID tagID, ULSCat categoryID, String output, Boolean fRethrowException, TryBlock tryBlock, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. Solution.Deserialize(EnhancedBinaryReader reader, SolutionIdentity solutionIdForErrorsOnly)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. Solution.ConstructFromSerializedStream(Stream stream, String assemblyRootFolder, SolutionIdentity solutionIdForErrorsOnly)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. SolutionCache.<>c__DisplayClassb.b__7()
at Microsoft.Office.InfoPath.Server.SolutionLifetime. SolutionCache.EnsureObjectInCache[T](HttpContext context, SolutionIdentity solutionId, String cacheId, ValidateCacheObject`1 validateCacheObject, CreateCacheObject`1 createCachedObject, AddToCache`1 cacheObject)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. SolutionCache.EnsureAdminSolutionInCache(HttpContext context, SolutionIdentity solutionId, FormTemplate formTemplate)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. SolutionCache.GetAdminSolutionById(SPSite site, HttpContext context, SolutionIdentity solutionId, Solution solutionInCache, String cacheId)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. SolutionCache.GetSolutionById(SPSite site, HttpContext context, SolutionIdentity solutionId)
at Microsoft.Office.InfoPath.Server. Controls.XmlFormView.DataBindInternal(SolutionMetaInformation solutionMetaInformation, DocumentMetaInformation documentMetaInformation, String absoluteSolutionLocation, Boolean hasCloseHandler, Document& document)
at Microsoft.Office.InfoPath.Server. Controls.XmlFormView.StartNewEditingSession()
at Microsoft.Office.InfoPath.Server. Controls.XmlFormView.EnsureDocument(EventLogStart eventLogStart)
at Microsoft.Office.InfoPath.Server. Controls.XmlFormView.<>c__DisplayClass3.b__1()
at Microsoft.Office.Server.Diagnostics. FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)



In the event log it says


Source - Office Sharepoint Server
EventID - 5333
Category - Forms Services Conversion and Deployment 1:30:57PM

Detected converted data version mismatch. Solution Id:938c6d9d-5264-4ba3-8a20-8417e03d2cbf:ver:12.0.0.1, expected version:4, saved version: 3. (User: MOSS\Admin, IP: 10.10.1.1, Request: http://MOSS/_layouts/CstWrkflIP.aspx?List={FAB78E36-0CAB-4B30-ADC5-248813312DF8})




Source - Office Sharepoint Server
EventID - 5368
Category - Forms Services Runtime 1:31:10PM

Exception occurred during request processing. (User: MOSS\Admin, Form Name: , IP: 10.10.1.1, Request: http://MOSS/_layouts/CstWrkflIP.aspx?List={FAB78E36-0CAB-4B30-ADC5-248813312DF8}, Form ID: , Type: ArgumentException, Exception Message: An item with the same key has already been added.)



Solution:
Open an command prompt and run "stsadm -o reconvertallformtemplates".

Do not run from the Run option in the Start menu!

1 comment:

Robot said...

We have the InfoPath Form Server version of SharePoint v3 running on a single server and we're trying to delete a form from the Manage Form Templates page in Application Management.

When we hover and select Delete it give us a SharePoint error page that says:

An item with the same key has already been added.

I've got no idea what's going on here but, in the past, when we've had trouble with form templates, the template would indicate Deleting and never change and never go away. We could run stsadm.exe -o execsvcjobs and the form would disappear.

This led me to believe it had something to do with some job service but I've never been able to figure out where or how to access any of that. I find the Timer Job Definitions and the Time Job Status but I'be never been able to find anything that would idicate that a job is configured or runs that is intended to delete those form templates.