We run a Bitbucket server v7.20.0 and merge feature branches by pull requests into the master branch. We use the "Delete after merging" feature to let Bitbucket clean up the feature branches after they have been merged into master.
However on an irregular basis this operation fails. The code is merged successfully, but the feature branch doesn't get deleted. The error message reads: "Clean up failed. The pull request was merged, but source branch couldn't be deleted". We then have to delete the branches manually, which of course defeats the purpose.
As the documentation explains (https://confluence.atlassian.com/bitbucketserver0720/merge-a-pull-request-1116281190.html), certain criteria must be met in order for this feature to work. All of them apply to our configuration (it's not the default branch, permissions are set and no other pull requests are open). The issue happens on and off for the same user on the same repository.
I haven't found any open issues or related articles about this. Does anyone know what's the problem here and how to fix it?