locked
Encountering error TF401349 when attempting to import corrected work item template. TFS 2017 Update 2 RRS feed

  • Question

  • I have ran the TFSmigrator tool and found some errors in my UserStory.xml template. I have corrected those errors however when I attempt to import the xml back into TFS, I encounter the following error: 

    TF401349: An unexpected error has occurred, please verify your request and try again. 

    Looking at the Event Viewer logs for this I can see the following logged: 

    System.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK__#A2C9281__06C703C1E4133C8C'. Cannot insert duplicate key in object 'dbo.@tempIdMap'. The duplicate key value is (-20188). at Microsoft.TeamFoundation.Framework.Server.TeamFoundationSqlResourceComponent.MapException(SqlException ex, QueryExecutionState queryState) etc etc etc etc............

    I literally can't seem to find anything online about this error and the TFS migration knowledge base does not recognise the error code. Based around some other problems that others have been encountering I have tried the following:

    Clearing the local cache,
    Clearing the server cache,
    IIS reset,
    Stopping and starting the collection,
    Detaching and attaching the collection,
    Reseeding all the tables in the configuration and default collection databases.

    I have 3 projects, with two I cannot make changes to the UserStory.xml, but can happily update other templates. The last project uses the same XML definition as the first two and can be updated.

    Bit of a loss as to what to do now though. Any ideas?
    Wednesday, October 25, 2017 2:46 PM

Answers

  • I appear to have solved it by doing the following:

    1. use witadmin to rename the work item type for the project. Something like -> 

      withadmin renamewitd /collection:http://localhost:8080/tfs/defaultcollection /p:"ProjectName" /n:"OriginalTemplateName" /new:"NewTemplateName"

    2. Make the necessary changes to the work item template for it to pass validation

    3. Use witadmin to rename the template back to its original name ->

      withadmin renamewitd /collection:http://localhost:8080/tfs/defaultcollection /p:"ProjectName" /n:"NewTemplateName" /new:"OriginalTemplateName"

          

     
    • Marked as answer by wolfbeard Thursday, October 26, 2017 10:09 AM
    Thursday, October 26, 2017 9:22 AM