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.

Atlassian JIRA | Mike Knight | 2 years ago
  1. 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 | 2 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.
  2. 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 | 2 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.
  3. 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 | 2 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.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 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 | 2 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.
  6. 0

    # Connect a Stash instance with a repository that contains a branch and a tag with the same name (they differ only by their prefix). Full ref names like this (yes, unfortunately this is legal in Git): ** {{refs/heads/release-1.0}} ** {{refs/tags/release-1.0}} # Set up a plan that uses this repository and select the {{release-1.0}} branch # Build the plan Expected: Checks out {{refs/heads/release-1.0}} and builds that branch. Actual: The following error occurs: {noformat} com.atlassian.bamboo.repository.RepositoryException: java.lang.RuntimeException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@rstocker:7999/project_1/rep_1.git' on branch 'heads/release-1.0'. Branch has probably been removed. at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:398) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:286) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:185) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:142) at com.atlassian.bamboo.build.BuildDetectionActionFactoryImpl$InitialBuildDetectionAction.performDelayedChangeDetection(BuildDetectionActionFactoryImpl.java:248) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2.getChainState(ChainExecutionManagerImpl.java:209) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:262) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:198) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy100.delayedStart(Unknown Source) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1$1.run(PlanExecutionManagerImpl.java:405) at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:85) at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:102) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:400) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:394) at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312) at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:85) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:761) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$200(PlanExecutionManagerImpl.java:126) at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1.run(PlanExecutionManagerImpl.java:388) 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 java.lang.Thread.run(Thread.java:745) Caused by: java.lang.RuntimeException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@rstocker:7999/project_1/rep_1.git' on branch 'heads/release-1.0'. Branch has probably been removed. at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:132) at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:88) at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:191) at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:176) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:501) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:358) ... 33 more Caused by: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@rstocker:7999/project_1/rep_1.git' on branch 'heads/release-1.0'. Branch has probably been removed. at com.atlassian.bamboo.plugins.stash.StashRepository.collectChangesSinceLastBuild(StashRepository.java:487) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$2.call(DefaultChangeDetectionManager.java:506) at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$2.call(DefaultChangeDetectionManager.java:502) at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:108) ... 38 more Caused by: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@rstocker:7999/project_1/rep_1.git' on branch 'heads/release-1.0'. Branch has probably been removed. at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:543) at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:225) at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:213) at com.atlassian.bamboo.plugins.stash.StashRepository.collectChangesSinceLastBuild(StashRepository.java:483) ... 41 more {noformat} The problem is that it uses {{heads/release-1.0}} as the branch name. Also note that in the dropdown when selecting the branch, it shows up like this: !bamboo-branch-selection.png! This is how the data returned by Stash for this request looks like: !bamboo-stash-response.png! I guess Bamboo just uses the displayId, instead of storing the full ref name or doing its own ref name shortening.

    Atlassian JIRA | 2 years ago | Robin Stocker
    com.atlassian.bamboo.repository.RepositoryException: java.lang.RuntimeException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://git@rstocker:7999/project_1/rep_1.git' on branch 'heads/release-1.0'. Branch has probably been removed.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. 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()
    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