TeamCity 2026.1.3: Git labeling fails with src refspec does not match any after merge
Hi,
I recently saw, that TeamCity cannot label my commits after a merge. I always get the following error in the web panel:
Failed to set label 'label-name': refs/tags/label-name cannot be resolved to branch Full error: git -c credential.helper= -c credential.helper=/opt/TeamCity/temp/credHelper*.sh push git@bitbucket.org:project/repo
Then I started looking into the logs of the Server and saw this:
[2026-08-13 10:44:10,698] INFO [anges monitor 1] - jetbrains.buildServer.VCS - Found 2 VCS root instances where periodical checking for changes is required
[2026-08-13 10:44:20,714] INFO [anges monitor 1] - jetbrains.buildServer.VCS - Found 15 VCS root instances where periodical checking for changes is required
[2026-08-13 10:44:30,718] INFO [anges monitor 1] - jetbrains.buildServer.VCS - Found 4 VCS root instances where periodical checking for changes is required
[2026-08-13 10:44:50,789] INFO [anges monitor 1] - jetbrains.buildServer.VCS - Found 14 VCS root instances where periodical checking for changes is required
[2026-08-13 10:44:57,995] INFO [mal executor 12] - iggers.vcs.git.GitMergeSupport - Merge in root "project_master" {instance id=3, parent internal id=1, parent id=ProjectMaster, description: "git@bitbucket.org:project/repo#refs/heads/master"}, revision x, destination refs/heads/master
[2026-08-13 10:44:58,005] INFO [prio executor 3] - jetbrains.buildServer.VCS - Labeling VCS root "project_master" {instance id=3, parent internal id=1, parent id=ProjectMaster, description: "git@bitbucket.org:project/repo#refs/heads/master"}@x for build #1.0.1 {build id=16918, buildTypeId=Project_ReleaseCandidate}
[2026-08-13 10:44:59,481] WARN [prio executor 3] - jetbrains.buildServer.VCS - Failed to run operation within 1 attempt: jetbrains.buildServer.vcs.VcsException: git -c credential.helper= -c credential.helper=/opt/TeamCity/temp/credHelper*.sh push git@bitbucket.org:project/repo 1.0.1 command failed.
exit code: 1
stderr: error: src refspec 1.0.1 does not match any
error: failed to push some refs to 'bitbucket.org:project/repo' (enable debug to see stacktrace)
[2026-08-13 10:44:59,506] WARN [prio executor 3] - jetbrains.buildServer.VCS - Failed to delete local tag 1.0.1 of x after unssuccessful push for "project_master" {instance id=3, parent internal id=1, parent id=ProjectMaster, description: "git@bitbucket.org:project/repo#refs/heads/master"}
jetbrains.buildServer.vcs.VcsException: git tag -d 1.0.1 command failed.
exit code: 1
stderr: error: tag '1.0.1' not found.
at jetbrains.buildServer.buildTriggers.vcs.git.command.impl.CommandUtil.commandFailed(CommandUtil.java:76)
at jetbrains.buildServer.buildTriggers.vcs.git.command.impl.CommandUtil.checkCommandFailed(CommandUtil.java:41)
at jetbrains.buildServer.buildTriggers.vcs.git.command.impl.CommandUtil.runCommand(CommandUtil.java:139)
at jetbrains.buildServer.buildTriggers.vcs.git.command.impl.CommandUtil.runCommand(CommandUtil.java:113)
at jetbrains.buildServer.buildTriggers.vcs.git.command.impl.TagCommandImpl.call(TagCommandImpl.java:99)
at jetbrains.buildServer.buildTriggers.vcs.git.command.NativeGitCommands.tag(NativeGitCommands.java:514)
at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport$1.lambda$label$0(GitVcsSupport.java:392)
at jetbrains.buildServer.buildTriggers.vcs.git.RepositoryManagerImpl.runWithDisabledRemove(RepositoryManagerImpl.java:254)
at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport$1.label(GitVcsSupport.java:391)
at jetbrains.vcs.api.services.impl.LabelingServiceProvider$1.label(LabelingServiceProvider.java:1)
at jetbrains.buildServer.vcs.impl.VcsLabeler.lambda$doSetLabel$5(VcsLabeler.java:30)
at jetbrains.buildServer.serverSide.impl.BaseAccessChecker.runWithDisabledChecks(BaseAccessChecker.java:4)
at jetbrains.buildServer.serverSide.impl.SecondaryNodeSecurityManager.executeSafe(SecondaryNodeSecurityManager.java:22)
at jetbrains.buildServer.serverSide.IOGuardInitializer$IOGuardDelegateImpl.allowNetworkAndCommandLine(IOGuardInitializer.java:6)
at jetbrains.buildServer.serverSide.IOGuard.allowNetworkAndCommandLine(IOGuard.java:117)
at jetbrains.buildServer.vcs.impl.VcsLabeler.doSetLabel(VcsLabeler.java:161)
at jetbrains.buildServer.vcs.impl.VcsLabeler.lambda$createLabelingTasks$4(VcsLabeler.java:155)
at jetbrains.buildServer.vcs.impl.VcsLabeler.executeTasks(VcsLabeler.java:115)
at jetbrains.buildServer.vcs.impl.VcsLabeler.updateLabels(VcsLabeler.java:134)
at jetbrains.buildServer.vcs.impl.VcsLabeler.lambda$new$0(VcsLabeler.java:39)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
[2026-08-13 10:44:59,508] WARN [prio executor 3] - jetbrains.buildServer.VCS - Failed to set label '1.0.1' for build #1.0.1 {build id=16918, buildTypeId=Project_ReleaseCandidate}: jetbrains.buildServer.vcs.VcsException: git -c credential.helper= -c credential.helper=/opt/TeamCity/temp/credHelper*.sh push git@bitbucket.org:project/repo 1.0.1 command failed.
exit code: 1
stderr: error: src refspec 1.0.1 does not match any
error: failed to push some refs to 'bitbucket.org:project/repo' (enable debug to see stacktrace)
[2026-08-13 10:44:59,520] INFO [prio executor 3] - jetbrains.buildServer.VCS - Labeling VCS root "projectTest_master" {instance id=4, parent internal id=2, parent id=ProjectMaster, description: "git@bitbucket.org:project/repo#refs/heads/master"}@x for build #1.0.1 {build id=16918, buildTypeId=Project_ReleaseCandidate}
[2026-08-13 10:45:05,329] INFO [prio executor 3] - jetbrains.buildServer.VCS - Tag '1.0.1' was successfully pushed for "projectTest_master" {instance id=4, parent internal id=2, parent id=ProjectMaster, description: "git@bitbucket.org:project/repo#refs/heads/master"}
[2026-08-13 10:45:06,419] INFO [mal executor 12] - iggers.vcs.git.GitMergeSupport - Merge successfully finished in root "projectTest_master" {instance id=3, parent internal id=1, parent id=ProjectMaster, description: "git@bitbucket.org:project/repo#refs/heads/master"}, revision x, destination refs/heads/master
[2026-08-13 10:45:06,420] INFO [mal executor 12] - iggers.vcs.git.GitMergeSupport - Merge in root "projectTest_master" {instance id=4, parent internal id=2, parent id=ProjectMaster, description: "git@bitbucket.org:project/repo#refs/heads/master"}, revision x, destination refs/heads/master
[2026-08-13 10:45:10,831] INFO [anges monitor 1] - jetbrains.buildServer.VCS - Found 2 VCS root instances where periodical checking for changes is required
[2026-08-13 10:45:13,948] INFO [mal executor 12] - iggers.vcs.git.GitMergeSupport - Merge successfully finished in root "projectTest_master" {instance id=4, parent internal id=2, parent id=ProjectMaster, description: "git@bitbucket.org:project/repo#refs/heads/master"}, revision x, destination refs/heads/master
[2026-08-13 10:45:20,865] INFO [anges monitor 1] - jetbrains.buildServer.VCS - Found 2 VCS root instances where periodical checking for changes is required
[2026-08-13 10:45:30,869] INFO [anges monitor 1] - jetbrains.buildServer.VCS - Found 15 VCS root instances where periodical checking for changes is required
[2026-08-13 10:45:40,914] INFO [anges monitor 1] - jetbrains.buildServer.VCS - Found 4 VCS root instances where periodical checking for changes is required
TeamCity 2026.1.3 (build 222742)
I don't believe the VCS configuration itself is the cause, because my setup worked previously and I did not make any configuration changes before the problem started occurring.
What I find particularly interesting is that there are two VCS root instances pointing to the same repository and branch. The first instance fails to create/push the tag because the local tag apparently does not exist (this one merges), while the second instance successfully creates and pushes it (this one does not merge).
It looks like the Merge and the labeling happens at the same time.
Any guidance on the cause of this behavior and the recommended fix would be greatly appreciated.
Thanks!
Please sign in to leave a comment.
Hi,
Thanks for the detailed logs. They confirm that Automatic Merge and VCS Labeling overlap:
• The merge for VCS root instance 3 starts at `10:44:57.995`.
• Labeling for the same instance starts at `10:44:58.005`.
• The merge does not complete until `10:45:06.419`.
However,
src refspec 1.0.1 does not match anyonly means that the local repository used by the push did not contain a branch or tag named1.0.1at that moment. Since the labeling operation is expected to create the tag before pushing it, the error does not by itself prove that the tag was simply waiting for the merge to finish. It may indicate an interaction between the two concurrent server-side VCS operations or a TeamCity Git plugin issue.Also, according to the log, VCS root instance 4 appears to be merged as well: its merge starts at
10:45:06.420and finishes at10:45:13.948. Therefore, it would be useful to verify whether Automatic Merge is being applied to both attached roots.As an initial workaround, please try setting the Automatic Merge run policy to Merge before build finish. VCS Labeling runs in the background after the build finishes, so this should prevent the two operations from overlapping.
Since both VCS roots point to the same Git repository, I would also recommend configuring VCS Labeling for only one of them. A Git tag belongs to the repository, so applying the same tag through both roots is redundant and can result in a partial labeling failure even if one of the roots pushes it successfully.
If the issue persists, could you please provide:
1. An export or Kotlin DSL representation of the affected build configuration, including the attached VCS roots, Automatic Merge feature, and VCS Labeling feature.
2. The Automatic Merge run policy currently selected.
3. A debug-level
teamcity-vcs.logcovering the complete merge and labeling operation.One additional point: TeamCity VCS Labeling labels the revisions used by the build. If the intention is to tag a newly created merge commit on the destination branch, please confirm that as well, since that is not necessarily the same revision as the build’s source revision.