How to fix “TF400898: An Internal Error Occurred.” on your Kanban board in TFS 2012 Update 2

Kanban customizable columns was made publicly available in VS Update 2. You can read the release notes for an overview of the feature itself, and you can read an in-depth article to understand what happens under the hood.

If you have an on premises installation of TFS, you might see the following error on the Kanban board

 

The goal of this blog post is to get this error resolved.

Why is this happening?

In the in-depth article you can read that the work items on the board have states and the board columns. When you visit the board for the first time there are no board settings yet and it provisions itself to create the initial board settings. During the provisioning the board is creating a column for all the states that are mapped in the common configuration.

Imagine that you have the following common configuration

<RequirementWorkItems category="Microsoft.RequirementCategory" plural="Stories">
    <States>
      <State value="New" type="Proposed" />
      <State value="Active" type="InProgress" />
      <State value="Resolved" type="InProgress" />
      <State value="Closed" type="Complete" />
    </States>
  </RequirementWorkItems>

It will create the following board by using the following rules

  • Incoming column: first state in the Proposed or InProgress ‘metastate’.
  • Outgoing column: last state in the Complete ‘metastate’
  • In Progress: all other states

 

 

When displaying the board we run two queries, a query to get all Proposed and InProgress items and the other one for the Complete items. And this is were the bug is: it makes the (wrong) assumption that all the items returned by the Complete query are in the Outgoing (the green) column.

How to fix it?

Fortunately the bug is only in the provisioning logic. The steps that are described in the post are temporary changes to provision the board successfully and they will not cause any data loss. Once the board is provisioned, you can undo the temporary changes.

The two scenarios how you can get work items in a ‘Complete’ state which is not the Outgoing column are:

  1. Have multiple states mapped to the Complete metastate
  2. Have multiple work item types in the Requirement category, and these work item types do not share the last Complete state

Follow these steps to resolve the issue (replace the bold snippets with your own values) :

  1. Open the Developer Command Prompt for VS2012
  2. Export the categories

    witadmin exportcategories /collection:http://myTfsServer:8080/tfs/DefaultCollection /p:MyTeamProjectName /f:%temp%\categories.xml

  3. Open in notepad

    %windir%\system32\notepad %temp%\categories.xml

  4. Locate the snippet: <CATEGORY refname="Microsoft.RequirementCategory" name="Requirement Category">. It should look something like the following

      <CATEGORY refname="Microsoft.RequirementCategory" name="Requirement Category">
        <DEFAULTWORKITEMTYPE name="Product Backlog Item" />
        <WORKITEMTYPE name="Bug" />
      </CATEGORY>

  5. Remove all work items types except the DEFAULTWORKITEMTYPE by commenting them out (so you can undo the changes), which would result in my example in

      <CATEGORY refname="Microsoft.RequirementCategory" name="Requirement Category">
        <DEFAULTWORKITEMTYPE name="Product Backlog Item" />
    <!–    <WORKITEMTYPE name="Bug" /> –>

  6.   </CATEGORY>
  7. Save the changes
  8. Import the categories

    witadmin importcategories /collection:http://myTfsServer:8080/tfs/DefaultCollection /p:MyTeamProjectName /f:%temp%\categories.xml

  9. Export the common configuration

    witadmin exportcommonprocessconfig /collection:http://myTfsServer:8080/tfs/DefaultCollection /p:MyTeamProjectName /f:%temp%\commonconfig.xml

  10. Open in notepad

    %windir%\system32\notepad %temp%\commonconfig.xml

  11. Locate the snippet: <RequirementWorkItems category="Microsoft.RequirementCategory" plural="Backlog items">. It should look something like the following

    <RequirementWorkItems category="Microsoft.RequirementCategory" plural="Backlog items">
      <States>
        <State type="Proposed" value="New" />
        <State type="InProgress" value="Committed" />
        <State type="Complete" value="Approved" />
        <State type="Complete" value="Done" />
      </States>
    </RequirementWorkItems>

  12. Now update the mapping, so only the last state (based on the order you had defined in the States section of the RequirementsWorkItems) is mapped to Complete, and the work item type that was left in the Requirement category contains that state, which would result in my example in 

    <RequirementWorkItems category="Microsoft.RequirementCategory" plural="Backlog items">
      <States>
        <State type="Proposed" value="New" />
        <State type="InProgress" value="Committed" /> 
        <State type="InProgress" value="Approved" />
       
    <State type="Complete" value="Done" />
      </States>
    </RequirementWorkItems>

  13. Save the changes
  14. Import the updated common configuration

    witadmin importcommonprocessconfig /collection:http://myTfsServer:8080/tfs/DefaultCollection /p:MyTeamProjectName /f:%temp%\commonconfig.xml

  15. Now visit your board to start the provisioning. Wait until the board shows up.
  16. You can now undo the changes in the categories and the common configuration by using the same steps
  17. When you now visit your board, you might get an error, but that’s expected and let you correct the column mappings to a valid state.  

Note: we have seen one case where the customer got the exception after undoing the changes. If it happens to you, you want to follow these additional steps:

  1. Follow again the steps 1 to 14 from above
  2. Go to the board
  3. Click on the Customize Columns, which will bring up a dialog
  4. Rename all column names (by adding a ‘1’ for example to the name)
  5. Click OK to accept the changes and close the dialog
  6. Undo the changes to the Requirement category and the common configuration
  7. Go to the board

 

If you still have problems, please leave a comment and we will reach out to you.