'Failed to perform checkout on agent: Unable to delete conflicting workspace

I am getting the following error when I my agent runs in TeamCity.

Failed to perform checkout on agent: Unable to delete conflicting workspace TeamCity-A5-fee2105439be4e36a53500ff137e8d32;edad1ed6-183e-4bb2-a41e-8b82fc3fa26f\alex. Please delete it manually

Where do I find and how do I delete these conflicting workspaces?



Solution 1:[1]

This is talking about TFS/DevOps workspaces, not anything in your agent. I solved this by using tf.exe to delete workspaces from DevOps.

From the 'Developer Command Prompt for VS 2xxx' I ran these commands.

tf workspaces /collection https://dev.azure.com/<your org> /owner:[email protected]

The owner would be who your TeamCity VCS root is authenticating as which could be the account the TeamCity service account is running under, or whoever generated a DevOps PAT.

That will list out all the workspaces owned by that user, ACROSS ALL MACHINES. Find the workspaces that are attributed to a TeamCity build agent (comment on them may be "TeamCity checkout workspace") and run this command for each.

tf workspace /collection https://dev.azure.com/<your org> /delete "<workspace name>;<owner name>"

Note this is 'tf workspace', not 'workspaces'. For me the workspace was like "TeamCity-Af-(some GUID);[email protected]"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kevin Kalitowski