TC on Windows with Mercurial

I'm getting the following obscure error:

Failed for the root '"myvcsrootname" {instance id=2, parent internal id=1, parent id=myproj_myvcsrootname, description: "mercurial: https://bitbucket/project1"}: 'hg --config ui.interactive=False pull --config extensions.progress= --config "progress.format=topic number" --config progress.delay=0 --config progress.assume-tty=True https://[user]:******[user]/[project]' command failed.
stderr: abort: repository C:\TeamCity\bin\%ALLUSERSPROFILE%\JetBrains\TeamCity\system\caches\mercurial\hg_-5279579285027873633 not found!

My VCS configuration is basic:
     Pull from:[useracct]/[repo-name]
     Branch: Default
     Username: ...
     Password: ...
     everything else is default
     Test connection successful!

But when I run I get the above error.

I can run hg from the command line no problem (the hg executable is accessible, HG Command path: hg).
If I run the above command in the shell I get:

abort: no repository found in 'C:\[mycurrentdir]' (.hg not found)!

This makes sense because I'm not in my repo root.

I can't tell if TC is running into the same issue, but if it is how do I specify where the repo root is?  I tried using the path to the repo in the "VCS Root Name", but same error and the documents are very confusing.  I've tried a number of other online resources, but haven't found a working solution.  I don't think this is a permissions issue (file-system or repo).  I can attach the stack trace, but the only useful information I could find is the error I posted above.

Team City 9.1
Windows Server 2008 R2 (Windows 7)
Mercurial 3.3.3

Any help would be greatly appreciated.  Thanks.

Comment actions Permalink

Hi Brian,

Sorry for delay. The repository path "C:\TeamCity\bin\%ALLUSERSPROFILE%\JetBrains\TeamCity\system\caches\mercurial\hg_-5279579285027873633" looks incorrect. How did you configure TeamCity Data directory? Could you please echo %ALLUSERSPROFILE% and %TEAMCITY_DATA_PATH% variables?

Comment actions Permalink

Hi Alina,

Thanks for responding.

Initially, TeamCity set the data directory INSIDE the Windows directory.  I don't rememeber the exact path, but it was something like  C:\Windows\system32\...   This created some obvious permissions issues, so I ended up changing the data directory per a recommendation in the TeamCity docs (  These docs are for TeamCity 8, so maybe the recommended data directory location for TeamCity 9 is different, can you confirm?  Per the docs I added TEAMCITY_DATA_PATH as a system environment variable.  The variable value is set to %ALLUSERSPROFILE%\JetBrains\TeamCity.  

When I echo these vars I get:

PS C:\Users\bwalker> echo $ENV:ALLUSERSPROFILE
PS C:\Users\bwalker> echo $ENV:TEAMCITY_DATA_PATH
PS C:\Users\bwalker>

I'm not sure why 'C:\TeamCity\bin' is being prepended to the data directory path.


I changed the data directory parameter to an explicit path C:\ProgramData\JetBrains\TeamCity in the and re-initialized the build directory.  I had to redo the project and build configs, but it is now correctly able to initialize the VCS root.  

It appears there is a problem with how TeamCity interprets environment variables.  

Let me know if you need additional information.

Thanks for the assistance!



Please sign in to leave a comment.