It is not possible to produce an effective diff for pull request
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Problem
A pull request cannot be merged with a 500 error on a pull request stating:
Incoming branch 'branch' shares no common ancestor with target branch 'other_branch'. It is not possible to produce an effective diff for pull request 52 in PRO/web.
Diagnosis
You see the following in the atlassian-bitbucket.log
:
2016-05-09 10:02:45,101 DEBUG [http-nio-7990-exec-7] admin @1NICTZEx602x2096x1 1c2ktev 127.0.0.1 "GET /rest/api/latest/projects/WEB/repos/web/pull-requests/14027/merge HTTP/1.1" c.a.s.r.e.ServiceExceptionMapper Mapping ServiceException to REST response 500
com.atlassian.stash.scm.git.merge.NoCommonAncestorException: Incoming branch 'branch' shares no common ancestor with target branch 'other_branch'. It is not possible to produce an effective diff for pull request 52 in PRO/web.
Cause
Bitbucket's database is out of sync with it's file system usually because the database and file system were backed up separately while Bitbucket was still running. In the future shut down Bitbucket and then take a backup to ensure the filesystem is synchronized with the database.
Resolution
Decline and reopen the pull request which triggers a rescope of the pull request.