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

Improper Error Handling During Failure of Bitbucket Cloud Repository Import into Bitbucket DC

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 9.4.4
    • Repository - Import

      Issue Summary

      When a user attempts to import a Bitbucket cloud repository from the Bitbucket UI, Bitbucket executes the <Bitbucket-Home>/mesh/bin/git-scripts/ask-pass.pl script to pass the password to git command. However, if the script lacks executable permissions or the required Perl modules are missing, the script fails. In such cases, Bitbucket does not log the actual reason for the failure. Instead, it logs a generic message stating that the fetch operation failed with a Authentication error, giving the impression that the peer server rejected the authentication, even when the correct credentials were provided.

      Steps to Reproduce

      1. Revoke executable permissions for the <Bitbucket-Home>/mesh/bin/git-scripts/ask-pass.pl file on the Linux server, or move the strict module's <Perl-directory>/strict.pm file to a different location.
      2. Attempt to import a Bitbucket Cloud repository into Bitbucket Data Center via the Bitbucket Cloud option in the UI.

      Expected Results

      Bitbucket should log the exact reason for the failure, such as insufficient permissions or errors encountered during the execution of the Perl script.

      Actual Results

      • Bitbucket logs an exit code 128 in the mesh log and an authentication error in the Bitbucket main logs, making it seem as though the user's credentials were rejected by the peer application. In reality, the script was not executed, and the fetch operation was never initiated by Bitbucket. The logs should clearly indicate that the operation failed due to an error in executing the ask-pass.pl script, along with the specific error message.
        • Mesh log
          2025-05-29 20:05:48,969 DEBUG [grpc-async:thread-2] aman 5VELP3DHx1205x46x2 127.0.0.1 "RepositoryService/Fetch" (>1 <0) c.a.bitbucket.mesh.process.OsProcess 60114: [git fetch --atomic --force --prune --progress --no-tags https://ashrivastava3@bitbucket.org/ashrivastava3/bitbucket-cloud-repo.git +refs/*:refs/*] exited 128 in 1298ms (stdin: 0, stdout: 0, stderr: 593)
        • Bitbucket log
           2025-05-29 20:05:47,928 DEBUG [mirror-hash:metadata:thread-1]  c.a.s.i.m.h.DefaultMirrorHashService PRO1/bitbucket-cloud-repo[92]: Generated new METADATA hash '446d3c3337ed999b296c5ee67b25acc035dfb078c72305451080b6f6f168395b'
          2025-05-29 20:05:49,052 ERROR [pool-12-thread-1]  c.a.b.i.i.repository.RefSyncTask Failed to import repository: PRO1/bitbucket-cloud-repo[92]
          com.atlassian.bitbucket.scm.AuthenticationFailedScmException: Authentication failed
          	at com.atlassian.stash.internal.scm.git.mesh.FetchErrorTranslator.translate(FetchErrorTranslator.java:34)
          .
          .
          	at java.base/java.lang.Thread.run(Thread.java:840)
          	... 15 frames trimmed
          Caused by: com.atlassian.bitbucket.scm.git.command.fetch.GitFetchAuthenticationException: Authentication failed
          	... 27 common frames omitted
          

      Workaround

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

              Unassigned Unassigned
              83b3279fad28 Aman Shrivastava
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: