com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@<domain>:7999/<project>/<repo>.git' on branch 'bugfix/<branchname>'. Branch has probably been removed.

Atlassian JIRA | David Harper | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I was hoping this was going to be fixed with the new Stash integration in 5.6 but it doesn't look like it has. Stash 3.1.3 with 2L-OAuth both ways between Stash and Bamboo. All plans are set using the "Stash" repository type and the "Stash" build trigger. *Expected Result:* Upon push to Stash, it triggers a new branch build in Bamboo. Upon successful Pull Request merge in Stash the git branch is deleted. This triggers Bamboo to disable the branch until the expiry date on the Plan. When that expiry date is hit, the Bamboo Branch Plan is deleted from the list. *Actual Result:* The branch in Bamboo gets disabled but not deleted. When the branch cleanup plan gets run at 3am it spams the logs with hundreds of errors representing each branch it can no longer find. The branch plan remains in Bamboo. {code:title=atlassian-bamboo.log} 2014-08-05 03:00:06,745 ERROR [QuartzScheduler_Worker-2] [BranchExpiryJob] Error in chain branch expiry com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@<domain>:7999/<project>/<repo>.git' on branch 'bugfix/<branchname>'. Branch has probably been removed. at com.atlassian.bamboo.plugins.stash.StashRepository.getLastCommit(StashRepository.java:693) at com.atlassian.bamboo.plan.branch.BranchExpiryJob.execute(BranchExpiryJob.java:94) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) Caused by: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@<domain>:7999/<project>/<repo>.git' on branch 'bugfix/<branchname>'. Branch has probably been removed. at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:543) at com.atlassian.bamboo.plugins.git.GitRepository.getLastCommit(GitRepository.java:590) at com.atlassian.bamboo.plugins.stash.StashRepository.getLastCommit(StashRepository.java:689) ... 7 more {code}

    Atlassian JIRA | 3 years ago | David Harper
    com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@<domain>:7999/<project>/<repo>.git' on branch 'bugfix/<branchname>'. Branch has probably been removed.
  2. 0

    I was hoping this was going to be fixed with the new Stash integration in 5.6 but it doesn't look like it has. Stash 3.1.3 with 2L-OAuth both ways between Stash and Bamboo. All plans are set using the "Stash" repository type and the "Stash" build trigger. *Expected Result:* Upon push to Stash, it triggers a new branch build in Bamboo. Upon successful Pull Request merge in Stash the git branch is deleted. This triggers Bamboo to disable the branch until the expiry date on the Plan. When that expiry date is hit, the Bamboo Branch Plan is deleted from the list. *Actual Result:* The branch in Bamboo gets disabled but not deleted. When the branch cleanup plan gets run at 3am it spams the logs with hundreds of errors representing each branch it can no longer find. The branch plan remains in Bamboo. {code:title=atlassian-bamboo.log} 2014-08-05 03:00:06,745 ERROR [QuartzScheduler_Worker-2] [BranchExpiryJob] Error in chain branch expiry com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@<domain>:7999/<project>/<repo>.git' on branch 'bugfix/<branchname>'. Branch has probably been removed. at com.atlassian.bamboo.plugins.stash.StashRepository.getLastCommit(StashRepository.java:693) at com.atlassian.bamboo.plan.branch.BranchExpiryJob.execute(BranchExpiryJob.java:94) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) Caused by: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@<domain>:7999/<project>/<repo>.git' on branch 'bugfix/<branchname>'. Branch has probably been removed. at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:543) at com.atlassian.bamboo.plugins.git.GitRepository.getLastCommit(GitRepository.java:590) at com.atlassian.bamboo.plugins.stash.StashRepository.getLastCommit(StashRepository.java:689) ... 7 more {code}

    Atlassian JIRA | 3 years ago | David Harper
    com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@<domain>:7999/<project>/<repo>.git' on branch 'bugfix/<branchname>'. Branch has probably been removed.
  3. 0

    For plans with automatic branch management, if a branch is deleted in the VCS repo, the corresponding branch plan will be automatically disabled. It will then be deleted by Bamboo after a number of days (as per the "plan branch cleanup" setting) during the daily 3am branch expiry clean-up. With 5.6 we've noticed that some plans are not having their branch plans expired up as they previously were. So far we've found this only affects plans that have a Stash repository (Git repos appear to be unaffected) where the branch has already been deleted from the VCS repo. In these cases, the server logs from the 3am clean-up job include errors like this one below: {noformat} 2014-08-05 03:00:00,045 INFO [QuartzScheduler_Worker-7] [BranchExpiryJob] Checking branches of Plan My Project - FOO 2014-08-05 03:00:00,045 INFO [QuartzScheduler_Worker-7] [BranchExpiryJob] Threshold date is Sun Jul 06 00:00:00 UTC 2014 2014-08-05 03:00:00,568 ERROR [QuartzScheduler_Worker-7] [BranchExpiryJob] Error in chain branch expiry com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@stash.example.com:7997/myproject/myrepo.git' on branch 'FOO-123_development_environment_setup'. Branch has probably been removed. at com.atlassian.bamboo.plugins.stash.StashRepository.getLastCommit(StashRepository.java:693) at com.atlassian.bamboo.plan.branch.BranchExpiryJob.execute(BranchExpiryJob.java:94) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) Caused by: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@stash.example.com:7997/myproject/myrepo.git' on branch 'FOO-123_development_environment_setup'. Branch has probably been removed. at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:543) at com.atlassian.bamboo.plugins.git.GitRepository.getLastCommit(GitRepository.java:590) at com.atlassian.bamboo.plugins.stash.StashRepository.getLastCommit(StashRepository.java:689) ... 7 more {noformat} and the branch plan will remain in Bamboo indefinitely (albeit disabled). We have branch plans from 2 months ago, despite 'Plan branch cleanup' being set to 'Remove after 7 days'. *Workaround* A temporary workaround to avoid having cluttered with so many branches will be to run this command on your database and restart Bamboo when you have downtime. {code:sql} update build set marked_for_deletion=1 where suspended_from_building=1 and build_type="chain_branch"; {code}

    Atlassian JIRA | 3 years ago | Mike Knight
    com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@stash.example.com:7997/myproject/myrepo.git' on branch 'FOO-123_development_environment_setup'. Branch has probably been removed.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    For plans with automatic branch management, if a branch is deleted in the VCS repo, the corresponding branch plan will be automatically disabled. It will then be deleted by Bamboo after a number of days (as per the "plan branch cleanup" setting) during the daily 3am branch expiry clean-up. With 5.6 we've noticed that some plans are not having their branch plans expired up as they previously were. So far we've found this only affects plans that have a Stash repository (Git repos appear to be unaffected) where the branch has already been deleted from the VCS repo. In these cases, the server logs from the 3am clean-up job include errors like this one below: {noformat} 2014-08-05 03:00:00,045 INFO [QuartzScheduler_Worker-7] [BranchExpiryJob] Checking branches of Plan My Project - FOO 2014-08-05 03:00:00,045 INFO [QuartzScheduler_Worker-7] [BranchExpiryJob] Threshold date is Sun Jul 06 00:00:00 UTC 2014 2014-08-05 03:00:00,568 ERROR [QuartzScheduler_Worker-7] [BranchExpiryJob] Error in chain branch expiry com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@stash.example.com:7997/myproject/myrepo.git' on branch 'FOO-123_development_environment_setup'. Branch has probably been removed. at com.atlassian.bamboo.plugins.stash.StashRepository.getLastCommit(StashRepository.java:693) at com.atlassian.bamboo.plan.branch.BranchExpiryJob.execute(BranchExpiryJob.java:94) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) Caused by: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@stash.example.com:7997/myproject/myrepo.git' on branch 'FOO-123_development_environment_setup'. Branch has probably been removed. at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:543) at com.atlassian.bamboo.plugins.git.GitRepository.getLastCommit(GitRepository.java:590) at com.atlassian.bamboo.plugins.stash.StashRepository.getLastCommit(StashRepository.java:689) ... 7 more {noformat} and the branch plan will remain in Bamboo indefinitely (albeit disabled). We have branch plans from 2 months ago, despite 'Plan branch cleanup' being set to 'Remove after 7 days'. *Workaround* A temporary workaround to avoid having cluttered with so many branches will be to run this command on your database and restart Bamboo when you have downtime. {code:sql} update build set marked_for_deletion=1 where suspended_from_building=1 and build_type="chain_branch"; {code}

    Atlassian JIRA | 3 years ago | Mike Knight
    com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@stash.example.com:7997/myproject/myrepo.git' on branch 'FOO-123_development_environment_setup'. Branch has probably been removed.

    Root Cause Analysis

    1. com.atlassian.bamboo.repository.InvalidRepositoryException

      Cannot determine head revision of 'ssh://git@<domain>:7999/<project>/<repo>.git' on branch 'bugfix/<branchname>'. Branch has probably been removed.

      at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision()
    2. com.atlassian.bamboo
      BranchExpiryJob.execute
      1. com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:543)
      2. com.atlassian.bamboo.plugins.git.GitRepository.getLastCommit(GitRepository.java:590)
      3. com.atlassian.bamboo.plugins.stash.StashRepository.getLastCommit(StashRepository.java:689)
      4. com.atlassian.bamboo.plan.branch.BranchExpiryJob.execute(BranchExpiryJob.java:94)
      4 frames
    3. quartz
      JobRunShell.run
      1. org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      1 frame
    4. com.atlassian.bamboo
      ImpersonationHelper$1.run
      1. com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)
      2. com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
      3. com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
      4. com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
      4 frames
    5. quartz
      SimpleThreadPool$WorkerThread.run
      1. org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
      1 frame