-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Low
-
Affects Version/s: 7.0.0, 8.0.0, 8.9.0, 8.19.0, 9.0.0, 9.2.0
-
Component/s: Repository - Branch Permissions
-
Severity 3 - Minor
Issue Summary
When a branch permission is set at the project level for Development or Production branch model when one is set to default branch, viewing Branch permissions for a repository that contains one or more branches but not the default branch shows 500 Internal server error page.
Steps to Reproduce
- Create a Project
- Make sure that the Settings > Branches has "Development" set to "Use default branch", which is the default setting for new projects.
- Go to Settings > Branch Permissions, choose Branching Model > Development and click any of the checkboxes and Save e.g.
- Create a new empty repository and clone it.
- Create a new branch `branch-1` with some content and push it `git push origin branch-1`
- Go to repository settings > Branch Permissions
Expected Results
Branch permissions shown from Project settings.
Actual Results
500 Internal server error page is shown
The below exception is thrown in the atlassian-bitbucket.log file:
2024-10-11 13:47:43,069 ERROR [http-nio-7990-exec-5] o.a.c.c.C.[.[.[/bitbucket].[plugins] Servlet.service() for servlet [plugins] in context with path [/bitbucket] threw exception com.atlassian.bitbucket.repository.NoDefaultBranchException: No default branch is defined at com.atlassian.stash.internal.scm.git.mesh.DefaultErrorTranslator.translateNoDefaultBranch(DefaultErrorTranslator.java:332) at com.atlassian.stash.internal.scm.git.mesh.DefaultErrorTranslator.translate(DefaultErrorTranslator.java:124) at com.atlassian.stash.internal.scm.git.mesh.DefaultErrorTranslator.translateIfKnownCause(DefaultErrorTranslator.java:266) at com.atlassian.stash.internal.scm.git.mesh.DefaultErrorTranslator.maybeTranslate(DefaultErrorTranslator.java:57) at com.atlassian.stash.internal.scm.git.mesh.AbstractFutureResponseObserver.maybeTranslate(AbstractFutureResponseObserver.java:209) at com.atlassian.stash.internal.scm.git.mesh.AbstractFutureResponseObserver$ResponseFuture.translateCause(AbstractFutureResponseObserver.java:298) at com.atlassian.stash.internal.scm.git.mesh.AbstractFutureResponseObserver$ResponseFuture.get(AbstractFutureResponseObserver.java:235) at com.atlassian.stash.internal.scm.git.mesh.AbstractFutureResponseObserver.asResult(AbstractFutureResponseObserver.java:151) at com.atlassian.stash.internal.scm.git.mesh.AbstractFutureResponseObserver.asResult(AbstractFutureResponseObserver.java:139) at com.atlassian.stash.internal.scm.git.mesh.GrpcRefClient.resolveDefaultBranch(GrpcRefClient.java:147) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at jdk.internal.reflect.GeneratedMethodAccessor193.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at jdk.proxy3/jdk.proxy3.$Proxy530.resolveDefaultBranch(Unknown Source) at com.atlassian.stash.internal.scm.git.mesh.MeshGitCommandFactory$11.call(MeshGitCommandFactory.java:417) at com.atlassian.stash.internal.scm.git.mesh.MeshGitCommandFactory$11.call(MeshGitCommandFactory.java:411) at com.atlassian.stash.internal.repository.DefaultRefService.getDefaultBranch(DefaultRefService.java:216) at jdk.internal.reflect.GeneratedMethodAccessor885.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at jdk.internal.reflect.GeneratedMethodAccessor193.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at jdk.proxy3/jdk.proxy3.$Proxy347.getDefaultBranch(Unknown Source) at jdk.internal.reflect.GeneratedMethodAccessor885.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at jdk.proxy2/jdk.proxy2.$Proxy624.getDefaultBranch(Unknown Source) at jdk.internal.reflect.GeneratedMethodAccessor885.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at jdk.proxy99/jdk.proxy99.$Proxy2033.getDefaultBranch(Unknown Source) at com.atlassian.bitbucket.internal.branch.model.DefaultBranchModelService.getDevelopmentBranch(DefaultBranchModelService.java:267) at com.atlassian.bitbucket.internal.branch.model.DefaultBranchModelService.toBranchModel(DefaultBranchModelService.java:354) at com.atlassian.bitbucket.internal.branch.model.DefaultBranchModelService.lambda$getModel$3(DefaultBranchModelService.java:181) at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21)
Workaround
Push the default branch in the repository with some content or set the default branch from the repository settings to some existing branch.
