Bitbucket Data Center shows "A database error has occurred" on accessing repository permissions page

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary:

While accessing the Repository permissions page, an error message "A database error has occurred" pops up. 


Environment:

Bitbucket Data Center 8.8.1. It may be applicable to other versions of Bitbucket.

Diagnosis:

The atlassian-bitbucket.log will have the following error stack trace:

2023-03-08 15:00:49,199 INFO  [http-nio-7990-exec-251] atluser @1O4QDTWx900x4801481x0 4l0h82 192.168.x.x,192.168.x.x "GET /rest/api/latest/projects/PRO1/repos/repo5/permissions/search HTTP
/1.1" o.h.e.i.DefaultLoadEventListener HHH000327: Error performing load command
org.hibernate.InstantiationException: Cannot instantiate abstract class or interface:  : com.atlassian.stash.internal.user.InternalApplicationUser
        at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:79)
        at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:105)
        at org.hibernate.tuple.entity.AbstractEntityTuplizer.instantiate(AbstractEntityTuplizer.java:705)
        at org.hibernate.persister.entity.AbstractEntityPersister.instantiate(AbstractEntityPersister.java:5295)
        at org.hibernate.internal.SessionImpl.instantiate(SessionImpl.java:1643)
        at org.hibernate.internal.SessionImpl.instantiate(SessionImpl.java:1627)
        at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.hydrateEntityState(EntityReferenceInitializerImpl.java:255)
        at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.readRow(AbstractRowReader.java:80)
        at org.hibernate.loader.plan.exec.internal.EntityLoadQueryDetails$EntityLoaderRowReader.readRow(EntityLoadQueryDetails.java:288)
        at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractRows(ResultSetProcessorImpl.java:157)
        at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractResults(ResultSetProcessorImpl.java:94)
        at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:105)
        at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:285)
        at org.hibernate.persister.entity.AbstractEntityPersister.doLoad(AbstractEntityPersister.java:4521)
        at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4511)
        at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:571)
        at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:539)
        at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:208)
        at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:103)
        at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:74)
        at com.atlassian.stash.internal.hibernate.EntityEnrichingLoadListener.onLoad(EntityEnrichingLoadListener.java:83)
        at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:118)
        at org.hibernate.internal.SessionImpl.fireLoadNoChecks(SessionImpl.java:1231)
        at org.hibernate.internal.SessionImpl.immediateLoad(SessionImpl.java:1043)
        at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:185)
        at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:322)
        at com.atlassian.stash.internal.HibernateUtils.unwrap(HibernateUtils.java:197)
        at com.atlassian.stash.internal.HibernateUtils.initialize(HibernateUtils.java:86)
        at com.atlassian.stash.internal.user.InternalPermittedPrincipal.initialize(InternalPermittedPrincipal.java:77)
        at com.atlassian.stash.internal.HibernateUtils.initialize(HibernateUtils.java:88)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
        at java.base/java.util.stream.SliceOps$1$1.accept(Unknown Source)
        at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(Unknown Source)
        at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
        at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
        at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
        at com.atlassian.bitbucket.util.PageImpl.transform(PageImpl.java:147)
        at com.atlassian.bitbucket.util.PageImpl.transform(PageImpl.java:16)
        at com.atlassian.stash.internal.HibernateUtils.initializePage(HibernateUtils.java:122)
        at com.atlassian.stash.internal.user.HibernateRepositoryPermissionDao.findPrincipalsWithAccess(HibernateRepositoryPermissionDao.java:130)
        at jdk.internal.reflect.GeneratedMethodAccessor3356.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at jdk.internal.reflect.GeneratedMethodAccessor220.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at com.atlassian.stash.internal.user.DefaultPermissionAdminService$5.visit(DefaultPermissionAdminService.java:812)
        at com.atlassian.stash.internal.user.DefaultPermissionAdminService$5.visit(DefaultPermissionAdminService.java:800)
        at com.atlassian.bitbucket.dmz.user.PermittedPrincipalRepositorySearchRequest.accept(PermittedPrincipalRepositorySearchRequest.java:32)
        at com.atlassian.stash.internal.user.DefaultPermissionAdminService.searchPrincipals(DefaultPermissionAdminService.java:800)
        at jdk.internal.reflect.GeneratedMethodAccessor2805.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at jdk.internal.reflect.GeneratedMethodAccessor220.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at jdk.internal.reflect.GeneratedMethodAccessor2805.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
        at jdk.internal.reflect.GeneratedMethodAccessor2805.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        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 com.atlassian.stash.internal.rest.user.RepositoryPermissionResource.searchPermissions(RepositoryPermissionResource.java:458)
        at jdk.internal.reflect.GeneratedMethodAccessor3357.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.analytics.client.filter.UniversalAnalyticsFilter.doFilter(UniversalAnalyticsFilter.java:75)
        at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:33)
        at com.atlassian.bitbucket.internal.xcode.web.XcodeUserAgentFilter.doFilter(XcodeUserAgentFilter.java:36)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.bitbucket.internal.ratelimit.servlet.filter.RateLimitFilter.doFilter(RateLimitFilter.java:75)
        at com.atlassian.plugin.connect.plugin.auth.scope.ApiScopingFilter.doFilter(ApiScopingFilter.java:81)
        at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.stash.internal.web.auth.AuthorizationFailureInterceptor.doFilterInternal(AuthorizationFailureInterceptor.java:39)
        at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:85)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:112)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75)
        at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94)
        at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67)
        at com.atlassian.oauth2.provider.core.web.AccessTokenFilter.doFilter(AccessTokenFilter.java:81)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.plugin.connect.plugin.auth.oauth2.DefaultSalAuthenticationFilter.doFilter(DefaultSalAuthenticationFilter.java:69)
        at com.atlassian.plugin.connect.plugin.auth.user.ThreeLeggedAuthFilter.doFilter(ThreeLeggedAuthFilter.java:109)
        at com.atlassian.plugins.authentication.basicauth.filter.DisableBasicAuthFilter.doFilter(DisableBasicAuthFilter.java:70)
        at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:37)
        at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:26)
        at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:33)
        at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:90)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:73)
        at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:84)
        at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38)
        at java.base/java.lang.Thread.run(Unknown Source)
        ... 324 frames trimmed
2023-03-08 15:00:49,200 DEBUG [http-nio-7990-exec-251] atluser @1O4QDTWx900x4801481x0 4l0h82 192.168.x.x,192.168.x.x "GET /rest/api/latest/projects/PRO1/repos/repo5/permissions/search HTTP
/1.1" c.a.s.i.r.e.ServiceExceptionMapper Mapping ServiceException to REST response 500
com.atlassian.bitbucket.DataStoreException: A database error has occurred.
        at com.atlassian.stash.internal.aop.ExceptionRewriteAdvice.afterThrowing(ExceptionRewriteAdvice.java:47)
        at jdk.internal.reflect.GeneratedMethodAccessor3344.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at jdk.internal.reflect.GeneratedMethodAccessor2805.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
        at jdk.internal.reflect.GeneratedMethodAccessor2805.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        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 com.atlassian.stash.internal.rest.user.RepositoryPermissionResource.searchPermissions(RepositoryPermissionResource.java:458)
        at jdk.internal.reflect.GeneratedMethodAccessor3357.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.analytics.client.filter.UniversalAnalyticsFilter.doFilter(UniversalAnalyticsFilter.java:75)
        at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:33)
        at com.atlassian.bitbucket.internal.xcode.web.XcodeUserAgentFilter.doFilter(XcodeUserAgentFilter.java:36)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.bitbucket.internal.ratelimit.servlet.filter.RateLimitFilter.doFilter(RateLimitFilter.java:75)
        at com.atlassian.plugin.connect.plugin.auth.scope.ApiScopingFilter.doFilter(ApiScopingFilter.java:81)
        at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.stash.internal.web.auth.AuthorizationFailureInterceptor.doFilterInternal(AuthorizationFailureInterceptor.java:39)
        at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:85)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:112)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75)
        at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94)
        at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67)
        at com.atlassian.oauth2.provider.core.web.AccessTokenFilter.doFilter(AccessTokenFilter.java:81)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.plugin.connect.plugin.auth.oauth2.DefaultSalAuthenticationFilter.doFilter(DefaultSalAuthenticationFilter.java:69)
        at com.atlassian.plugin.connect.plugin.auth.user.ThreeLeggedAuthFilter.doFilter(ThreeLeggedAuthFilter.java:109)
        at com.atlassian.plugins.authentication.basicauth.filter.DisableBasicAuthFilter.doFilter(DisableBasicAuthFilter.java:70)
        at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:37)
        at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:26)
        at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:33)
        at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:90)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:73)
        at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:84)
        at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38)
        at java.base/java.lang.Thread.run(Unknown Source)
        ... 296 frames trimmed
Caused by: org.hibernate.InstantiationException: Cannot instantiate abstract class or interface:  : com.atlassian.stash.internal.user.InternalApplicationUser
        at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:79)
        at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:105)
        at org.hibernate.tuple.entity.AbstractEntityTuplizer.instantiate(AbstractEntityTuplizer.java:705)
        at org.hibernate.persister.entity.AbstractEntityPersister.instantiate(AbstractEntityPersister.java:5295)
        at org.hibernate.internal.SessionImpl.instantiate(SessionImpl.java:1643)
        at org.hibernate.internal.SessionImpl.instantiate(SessionImpl.java:1627)
        at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.hydrateEntityState(EntityReferenceInitializerImpl.java:255)
        at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.readRow(AbstractRowReader.java:80)
        at org.hibernate.loader.plan.exec.internal.EntityLoadQueryDetails$EntityLoaderRowReader.readRow(EntityLoadQueryDetails.java:288)
        at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractRows(ResultSetProcessorImpl.java:157)
        at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractResults(ResultSetProcessorImpl.java:94)
        at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:105)
        at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:285)
        at org.hibernate.persister.entity.AbstractEntityPersister.doLoad(AbstractEntityPersister.java:4521)
        at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4511)
        at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:571)
        at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:539)
        at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:208)
        at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:103)
        at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:74)
        at com.atlassian.stash.internal.hibernate.EntityEnrichingLoadListener.onLoad(EntityEnrichingLoadListener.java:83)
        at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:118)
        at org.hibernate.internal.SessionImpl.fireLoadNoChecks(SessionImpl.java:1231)
        at org.hibernate.internal.SessionImpl.immediateLoad(SessionImpl.java:1043)
        at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:185)
        at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:322)
        at com.atlassian.stash.internal.HibernateUtils.unwrap(HibernateUtils.java:197)
        at com.atlassian.stash.internal.HibernateUtils.initialize(HibernateUtils.java:86)
        at com.atlassian.stash.internal.user.InternalPermittedPrincipal.initialize(InternalPermittedPrincipal.java:77)
        at com.atlassian.stash.internal.HibernateUtils.initialize(HibernateUtils.java:88)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
        at java.base/java.util.stream.SliceOps$1$1.accept(Unknown Source)
        at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(Unknown Source)
        at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
        at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
        at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
        at com.atlassian.bitbucket.util.PageImpl.transform(PageImpl.java:147)
        at com.atlassian.bitbucket.util.PageImpl.transform(PageImpl.java:16)
        at com.atlassian.stash.internal.HibernateUtils.initializePage(HibernateUtils.java:122)
        at com.atlassian.stash.internal.user.HibernateRepositoryPermissionDao.findPrincipalsWithAccess(HibernateRepositoryPermissionDao.java:130)
        at jdk.internal.reflect.GeneratedMethodAccessor3356.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at jdk.internal.reflect.GeneratedMethodAccessor220.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at com.atlassian.stash.internal.user.DefaultPermissionAdminService$5.visit(DefaultPermissionAdminService.java:812)
        at com.atlassian.stash.internal.user.DefaultPermissionAdminService$5.visit(DefaultPermissionAdminService.java:800)
        at com.atlassian.bitbucket.dmz.user.PermittedPrincipalRepositorySearchRequest.accept(PermittedPrincipalRepositorySearchRequest.java:32)
        at com.atlassian.stash.internal.user.DefaultPermissionAdminService.searchPrincipals(DefaultPermissionAdminService.java:800)
        at jdk.internal.reflect.GeneratedMethodAccessor2805.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at jdk.internal.reflect.GeneratedMethodAccessor220.invoke(Unknown Source)
        ... 49 common frames omitted


On enabling Database debug log, the following DB query can be seen just before the stack trace mentioned above. This query doesn't return any user details.

2023-03-08 15:00:49,196 DEBUG [http-nio-7990-exec-251] atluser @1ABC52Ix900x4801481x0 4l0h82 192.168.x.x,192.168.x.x "GET /rest/api/latest/projects/PRO1/repos/repo5/permissions/search HTTP
/1.1" org.hibernate.SQL select internalap0_.id as id1_132_0_, internalap0_1_.deleted_timestamp as deleted_1_107_0_, internalap0_1_.locale as locale2_107_0_, internalap0_1_.slug as slug3_107_0_, internalap0_1_.time_
zone as time_zon4_107_0_, internalap0_1_.name as name5_107_0_, internalap0_2_.active as active1_128_0_, internalap0_2_.display_name as display_2_128_0_, internalap0_2_.email_address as email_ad3_128_0_, internalap0
_2_.label as label4_128_0_, internalap0_2_.slug as slug5_128_0_, internalap0_2_.name as name6_128_0_, case when internalap0_1_.user_id is not null then 1 when internalap0_2_.user_id is not null then 2 when internal
ap0_.id is not null then 0 end as clazz_0_ from stash_user internalap0_ left outer join sta_normal_user internalap0_1_ on internalap0_.id=internalap0_1_.user_id left outer join sta_service_user internalap0_2_ on in
ternalap0_.id=internalap0_2_.user_id where internalap0_.id=?
2023-03-08 15:00:49,196 TRACE [http-nio-7990-exec-251] atluser @1O4QDTWx900x4801481x0 4l0h82 192.168.x.x,192.168.x.x "GET /rest/api/latest/projects/PRO1/repos/repo5/permissions/search HTTP
/1.1" o.h.type.descriptor.sql.BasicBinder binding parameter [1] as [INTEGER] - [103159]
2023-03-08 15:00:49,198 TRACE [http-nio-7990-exec-251] atluser @1O4QDTWx900x4801481x0 4l0h82 192.168.x.x,192.168.x.x "GET /rest/api/latest/projects/PRO1/repos/repo5/permissions/search HTTP
/1.1" o.h.t.descriptor.sql.BasicExtractor extracted value ([clazz_0_] : [INTEGER]) - [0]

In the above Database debug log, problematic user_id is 103159 (example), similar entries need to be verified in the logs when issue occurs.

Similarly, this entry can also be present for user_id 999999999 or some other number which should be verified in the logs as advised above as well as in the queries below.

2023-10-19 09:39:40,537 TRACE [http-nio-7990-exec-54] atluser @1ABC52Ix579x4033652x2 l0abc 192.168.x.x,192.168.x.x "GET /rest/api/latest/projects/PRO1/repos/repo5/permissions/search HTTP/1.1" o.h.type.descriptor.sql.BasicBinder binding parameter [1] as [INTEGER] - [999999999]

Cause:

The error occurs when user's detail doesn't exist in one of the sta_normal_user & sta_service_user tables but exists in at least one of the permission tables such as sta_global_permission, sta_repo_permission or sta_project_permission

bitbucket=# select * from sta_service_user where user_id=103159;
 user_id | display_name | active | name | slug | email_address | label 
---------+--------------+--------+------+------+---------------+-------
(0 rows)

bitbucket=# select * from sta_normal_user where user_id=103159;
 user_id | name | slug | locale | deleted_timestamp | time_zone 
---------+------+------+--------+-------------------+-----------
(0 rows) 

bitbucket=# select * from sta_project_permission where user_id = 103159;
 id | perm_id | project_id | group_name | user_id 
----+---------+------------+------------+---------
(0 rows)

bitbucket=# select * from sta_repo_permission where user_id = 103159;
 id | perm_id | repo_id | group_name | user_id 
----+---------+---------+------------+---------
(0 rows)

bitbucket=# select * from sta_global_permission where user_id = 103159;
    id     | perm_id | group_name | user_id 
-----------+---------+------------+---------
 999999999 |       7 |            |  103159 (1 row)


Solution:

  • Back up your data before performing the below modifications to the database.
  • If possible, test the queries on a staging server first.
  • Kindly reach out to Atlassian support if anything goes wrong or need assistance in understanding the procedure. 

  • Add a dummy entry against user id 103159 in the sta_normal_user. Kindly make sure the name and slug value dummyuser is unique among the cwd_user and sta_service_user tables.
insert into sta_normal_user(user_id,name,slug) values (103159,'dummyuser','dummyuser');
  • Remove the user's permission from permission tables using the API. API may vary, depending on the permission table user's entry is found.
curl -u <adminuser> --request DELETE --url 'http://{baseurl}/rest/api/latest/admin/permissions/users?name={dummyuser}'
  • After performing the above two steps, the issue should be fixed. It is advised to review the atlassian-bitbucket.log to look for any unforeseen errors.
  • Once the issue is resolved, update the deleted_timestamp column to a non-null value. A cleanup job runs every 6 hours and looks for the deleted_timestamp value which is 7 days old and deletes user-associated data such as access tokens, GPG keys, etc.

update sta_normal_user set deleted_timestamp = '2023-03-29 20:03:03.943000' where user_id = 103159;

Last modified on Jul 26, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.