Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-20142

ClassCastException: class com.atlassian.crowd.model.user.InternalUser cannot be cast to class com.atlassian.crowd.embedded.api.UserWithAttributes

XMLWordPrintable

      Issue Summary

      At the time of writing the exact steps to reproduce this problem are unknown. The problem occurs when using the User Export functionality. This can be found in the Bitbucket UI at Admin/Users/Export.

      The REST request for the export will fail with a HTTP status 500 and an error like the following will be reported in the atlassian-bitbucket.log:

      2025-07-24 18:00:00,000 ERROR [https-jsse-nio-8443-exec-24] ausername @1TRUFG7x976x79169x0 111efyw 123.456.789.111 "GET /rest/ui/latest/admin/users/export HTTP/1.1" c.a.s.i.user.DefaultUserAdminService 
      Exception while streaming users java.lang.ClassCastException: class com.atlassian.crowd.model.user.InternalUser cannot be cast to class com.atlassian.crowd.embedded.api.UserWithAttributes (com.atlassian.crowd.model.user.InternalUser and com.atlassian.crowd.embedded.api.UserWithAttributes are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @2f92e0f4)
      at com.atlassian.stash.internal.user.DefaultUserAdminService.lambda$convertToDetailedUser$10(DefaultUserAdminService.java:1048)
      at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
      at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
      ..
      

      While the exact system state necessary to cause this error is unknown right now, the code can be made to be more defensive and resilient. That is what this bug report proposes.

      Steps to Reproduce

      Unknown

      Expected Results

      User export should succeed

      Actual Results

      User export fails

      The below exception is thrown in the atlassian-bitbucket.log file:

      2025-07-24 18:00:00,000 ERROR [https-jsse-nio-8443-exec-24] ausername @1TRUFG7x976x79169x0 111efyw 123.456.789.111 "GET /rest/ui/latest/admin/users/export HTTP/1.1" c.a.s.i.user.DefaultUserAdminService 
      Exception while streaming users java.lang.ClassCastException: class com.atlassian.crowd.model.user.InternalUser cannot be cast to class com.atlassian.crowd.embedded.api.UserWithAttributes (com.atlassian.crowd.model.user.InternalUser and com.atlassian.crowd.embedded.api.UserWithAttributes are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @2f92e0f4)
      at com.atlassian.stash.internal.user.DefaultUserAdminService.lambda$convertToDetailedUser$10(DefaultUserAdminService.java:1048)
      at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
      at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
      ..
      

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

              behumphreys Ben Humphreys
              behumphreys Ben Humphreys
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: