I have been trying to track this down for the last couple days. I have pulled this exception from the teamcity-vcs.log file:
.hgtags@a41a9cc7a2d8, line 29: node 'd119f55cacaad1d839d1fd695556e' is not well formed
[2014-02-06 18:35:35,486] WARN [rmal executor 2] - jetbrains.buildServer.VCS - Failed to set label '188.8.131.52'
jetbrains.buildServer.vcs.VcsException: 'hg --config ui.interactive=False identify -b --rev e242c3bfebf1' command failed.
Running this command: hg --config ui.interactive=False identify -b --rev e242c3bfebf1 on the TeamCity server works.
This suggests that there is a malformed tag in the .hgtags file. I have found and removed the offending tag in source control, cleared out the <dir>:\TeamCityData\System\caches\Mercurial directory, and also cleaned up all source directories on the Team City agents.
It seems that Team City is holding on to a copy of the old .hgtags file and I cannot find any place it still exists.
I have tested that the repo is not corrupted. I have also set a label using mercurial with the same account that Team City is using so the problem is isolated to how Team City is labelling vs using hg from the command line.
Any help at this point would be greatly apprecaited.