Thursday, July 24, 2008

Bug in TFS 2008: "TF50605: There was an error looking up the SID for "

Here is a Bug we found in TFS 2008. At least I think it's a Bug. It happens when you try to delete (or perform other workspace actions) on a workspace owned by a user who no longer is in Active Directory.

1) Create an AD account and use it to log into TFS 2008, create workspaces and check out files.

2) Then, leaving some files checked out such, delete the account in AD. This is what happens when someone leaves your company.

3) Go back to TFS and try to delete their workspace. E.g. tf workspace /delete /server: Z055638-XPA;Z055638 *where Z055638 is the user who left the company.

4) You should get the error "TF50605: There was an error looking up the SID for Z055638" which to me means since the account can't be found in AD (the user left the company) you can't delete their workspace and thus can't "undo" any files they have checked out.

To resolve this, we had to manually update the TfsVersionControl, Tbl_Workspace table. Cameron Vetter's post gave us the idea. We changed the OwerId field to a valid user for that workspace. The we were able to delete it.

Not ideal, but worked for us. I've submitted this to Connect as well.


Andre Dias said...

Yeah.. I got this bug and posted here:

Mac Noland said...

Thanks Andre!!!

Unknown said...
This comment has been removed by the author.
Unknown said...

Thanks for the idea.

I couldn't use tf workspace /delete command because of this error

Here is the SQL command.

UPDATE [TfsVersionControl].[dbo].[tbl_Workspace]
SET [OwnerId] = 100 --200
where [WorkspaceId] = 1679
-- commit tran

where 200 is the invalid SID and 100 is a valid SID. Valid SID can be found in the same table. After that tf delete command works.

tf workspace /delete workspace;username

Br.Bill said...

but... but... how do I run SQL against that table, and what database do I connect to, etc., etc.?

I'm just a simple farm boy, Jim. I knows how to check me out some code, but I dunno what the name of a SQL interactive tool is or what the names of the databases are, etc.