TF237159: The query contains columns that are not valid

Symptoms:

Again, this is a work item validation result  (“TF237159: The query contains columns that are not valid”). It happens when you are trying to access the work items in question (even just the query result contains those work items).

Causes:

If you are getting this error, you might have deleted work item fields from “WitAdmin deletefield” command or modified the TFS database table (Fields) directly.

Solution:

11 thoughts on “TF237159: The query contains columns that are not valid”

  1. Here’s the deal, I added a row in the Fields table then deleted that row. Now I get the TF237159 error. I can make changes to the existing forms as long as I don’t add a new field – and of course I need to add a new field.

    Any ideas on how to fix? I did apply the latest SP1 patch, but no success.

    1. Your query may still have that deleted field in its definition. To verify this, edit the query, view the columns to see if that’s the case. TFS uses triggers to build the correlation and maintain the data integrity so it is possible your new-then-deleted field still partially exists somewhere.

      I suggest you to try
      1. Modify the queries to make sure no query is referencing the deleted fields
      2. Add the already-deleted field back and delete it from the tool (if you use the Process Editor) or edit it from the exported work item definition

      Hope no work item records are actually referencing the not-existing-anymore fields. You can verify that by checking the work item tables (WorkItemsAre, WorkItemsLatest, WorkItemWere). If yes, you need to remove (physically and permanently) those items first before TFS will allow you to remove that field.

      I will try to make a backup before going further. Especially those workitem tables.

      Hope this can help. Let me know.

      1. I really appreciate the response and I’ve been working on this all day.
        There are no queries I can find using the field (it was new and I’m the only one on this server).
        I deleted the field from my Task Work Item from within Process Editor, however the field still exists in the Work Item Explorer and the Fields table.
        I looked at the WorkItems.. tables you mentioned, and their does not seem to be any reference to the field I just removed from my WI template.

        I have no problems unless I try to add a new field to the form. I get the TF237159 error. (I could re-add that Process Editor removed field with no problem).

        This would be very intersting if it weren’t for deadlines :-(. Any additional help would be greatly appreciated!

  2. One more tidbit that may help (or hurt). The TFSJobAgent.exe has not been able to run (pretty much coincident with this issue I’m having).

    “Detailed Message: TF221123: Job Work Item Tracking Warehouse Sync for team project collection ######## was was unable to run after 20 attempts.”

    I did rebuild both the WareHouse and Analysis databases with no seeming change in that error or the TF237159 I’m currently having.

    1. This is the discrepancy between databases and the data warehouse. Did you rebuild it from the admin console or just the web service interface? You have to do it from the admin console.

      And please note: The data warehouse will be wiped out and rebuilt. meaning you will lose whatever you have so far. But it shouldn’t concern you too much since this is a new environment and it will be rebuilt anyway. Just check few things you like to check (logs, functionality, etc.) for the before and after comparison. Depends on the size of the databases, it takes about few minutes to few hours.

      Another Note: This will affect the whole data warehouse for this server/farm (if you have a farm), not just the new project collection you are setting up (if you already have some other project collection setup before).

      As far as your previous question, I will have to try to re-produce it in my sandbox. But to clarify, you can add back and delete the previous added field but just can not add new new fields. Is that correct?

      1. To wrap up this question, I actually tried to rebuild both ways, first the Admin Console, then the Web Services. And yes for the Add and Delete, that was really weird, but maybe due to my impatience – the database is pretty small.
        This is basically a test system that was upgraded from TFS 2008 and I’m modifying the upgraded Agile 5.0 process to match the current business process. All I really want at the end of the day are the templates to update the production server to the new process and modules.

  3. I think I’ve solved the last of my issues. I manually deleted from the Projects Database references in Fields, FieldUsage, and WorkItemTypeUsages; emptied my Visual Studio Cache (just in case) then rebuilt my Warehouse and Analysis server.

    I was able to add new fields and put them in my Work Item definition and save – finally!

    Thanks for your help, you put me on the right track!

  4. I’m having this issue, but I have a default installation with SP1. Haven’t touched a thing. Didn’t touch the fields table. I don’t see anything in the logs. Any ideas? Sorry for reviving an old post

    1. This is an error from validation. So if you did not change any fields (from tools or directly), you can try to modify the query (both the criteria and result columns) to see if you can narrow down which field/column is causing the problem.

Leave a comment