MergeException caused by GitNonFastForwardUpdate RejectedException when merging PRs

When we try to merge different open PRs in to a same target ref (e.g., $branch of $repo) via Java API com.atlassian.bitbucket.pull.PullRequestService#merge, we got a MergeException:

com.atlassian.bitbucket.scm.MergeException: New changes were pushed to $branch in $project/$repo while the merge was being performed. Please retry the merge.
        at com.atlassian.stash.internal.scm.git.merge.MergeCommand.newMergeException(MergeCommand.java:192)
        at com.atlassian.stash.internal.scm.git.merge.MergeCommand.doWithWorkTree(MergeCommand.java:170)
        at com.atlassian.stash.internal.scm.git.merge.MergeCommand.call(MergeCommand.java:74)
        at com.atlassian.stash.internal.scm.git.merge.MergeCommand.call(MergeCommand.java:37)
        at com.atlassian.stash.internal.pull.DefaultPullRequestService$MergePullRequestOperation.perform(DefaultPullRequestService.java:2339)
        at com.atlassian.stash.internal.pull.DefaultPullRequestService.merge(DefaultPullRequestService.java:849)
        at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
        [...]
        at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134)
        at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106)
        at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90)
        at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:435)
        at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:430)
        at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJobWithRecoveryGuard(CaesiumSchedulerService.java:454)
        at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:382)
        at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66)
        at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60)
        at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35)
        at java.lang.Thread.run(Thread.java:748)
        ... 35 frames trimmed
Caused by: com.atlassian.bitbucket.scm.git.command.push.GitNonFastForwardUpdateRejectedException: The merge could not be completed because the target ref was updated mid-merge.
        at com.atlassian.stash.internal.scm.git.command.updateref.UpdateRefCommandExitHandler.evaluateStdErr(UpdateRefCommandExitHandler.java:28)
        at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:204)
        at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:32)
        at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:285)
        at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.finish(NioNuProcessHandler.java:326)
        at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.onExit(NioNuProcessHandler.java:123)
        at com.zaxxer.nuprocess.internal.BasePosixProcess.onExit(BasePosixProcess.java:307)
        at com.zaxxer.nuprocess.linux.ProcessEpoll.handleExit(ProcessEpoll.java:371)
        at com.zaxxer.nuprocess.linux.ProcessEpoll.cleanupProcess(ProcessEpoll.java:334)
        at com.zaxxer.nuprocess.linux.ProcessEpoll.process(ProcessEpoll.java:272)
        at com.zaxxer.nuprocess.internal.BaseEventProcessor.run(BaseEventProcessor.java:81)
        at com.zaxxer.nuprocess.linux.ProcessEpoll.run(ProcessEpoll.java:188)
        at com.zaxxer.nuprocess.linux.LinuxProcess.run(LinuxProcess.java:107)
        at com.zaxxer.nuprocess.linux.LinProcessFactory.runProcess(LinProcessFactory.java:50)
        at com.zaxxer.nuprocess.NuProcessBuilder.run(NuProcessBuilder.java:273)
        at com.atlassian.bitbucket.internal.process.nu.NuNioProcessHelper.run(NuNioProcessHelper.java:75)
        at com.atlassian.bitbucket.internal.process.NioCommand.call(NioCommand.java:52)
        at com.atlassian.stash.internal.scm.git.porcelain.AbstractTimedRequest.configureAndCall(AbstractTimedRequest.java:42)
        at com.atlassian.stash.internal.scm.git.fetch.ObjectFetchStrategy.updateRef(ObjectFetchStrategy.java:319)
        at com.atlassian.stash.internal.scm.git.fetch.ObjectFetchStrategy.fetch(ObjectFetchStrategy.java:122)
        at com.atlassian.stash.internal.scm.git.fetch.TimedFetchStrategy.fetch(TimedFetchStrategy.java:30)
        at com.atlassian.stash.internal.scm.git.merge.MergeCommand.doFetch(MergeCommand.java:123)
        at com.atlassian.stash.internal.scm.git.merge.MergeCommand.doWithWorkTree(MergeCommand.java:148)
        ... 24 common frames omitted
        Suppressed: com.atlassian.utils.process.ProcessException: Non-zero exit code: 128
                at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:277)
                ... 43 common frames omitted

We cannot get rid of this exception even if previously we “refresh” the PullRequest instance via Java API com.atlassian.bitbucket.pull.PullRequestService#getById:

final PullRequest pullRequest = [...];
final Repository repository = pullRequest.getFromRef().getRepository();

pullRequestService.merge(new PullRequestMergeRequest.Builder(
		pullRequestService.getById(repository.getId(), pullRequest.getId())
).build());

Any advice?
Thanks in advance.
Cheers.

According to How to diagnose/debug issues with Pull Request rescoping in Bitbucket Data Center | Bitbucket Data Center and Server | Atlassian Documentation, cause should be the rescope-pull-requests job stalled.
In fact, from the atlassian-bitbucket.log:

2022-03-23 12:15:28,758 INFO  [pull-request-rescoping:thread-1]  c.a.s.i.p.r.PullRequestRescopeBucketProcessor $project/$repo[$id]: Some pull requests were not rescoped. (0 failed, 1 locked). Scheduling attempt 2 in 20000ms
2022-03-23 12:15:28,915 INFO  [pull-request-rescoping:thread-1]  c.a.s.i.p.r.PullRequestRescopeBucketProcessor $project/$repo[$id]: Some pull requests were not rescoped. (0 failed, 1 locked). Scheduling attempt 3 in 40000ms
2022-03-23 12:15:48,775 INFO  [pull-request-rescoping:thread-1]  c.a.s.i.p.r.PullRequestRescopeBucketProcessor $project/$repo[$id]: Some pull requests were not rescoped. (0 failed, 1 locked). Scheduling attempt 4 in 600000ms
2022-03-23 12:16:08,932 INFO  [pull-request-rescoping:thread-1]  c.a.s.i.p.r.PullRequestRescopeBucketProcessor $project/$repo[$id]: Some pull requests were not rescoped. (0 failed, 1 locked). Scheduling attempt 5 in 600000ms
[...]
2022-03-23 12:38:33,179 INFO  [pull-request-rescoping:thread-1]  c.a.s.i.p.r.DefaultPullRequestRescopeService $project/$repo[$id]#2700 is locked for merging; it will be rechecked after the lock is released

How can we unlock PRs to perform this rescope job?
Thanks in advance.