Lesstep
GitLab · merge requests · merge API · Checked October 24, 2026

GitLab: why the merge was refused

When a merge through the API fails, GitLab answers with one of five statuses, and each means something different. From GitLab's merge API, checked against its source (lib/api/merge_requests.rb): 405 means that a merge check stops the merge request right now, 409 that the source branch moved, 422 that the merge itself failed, 401 that your account may not merge into the target branch, and 400 that the group or instance requires the commit SHA.

The answers

To see why GitLab will not merge, before you try: Merge Request (MR) Review Inbox for GitLab, a plugin for JetBrains IDEs, shows the merge checks from detailed_merge_status with the blocking ones first, and says for each refusal which case it is.

Which merge check stops it (405)

Read the merge request and look at detailed_merge_status:

curl -H "PRIVATE-TOKEN: your-token" "https://gitlab.com/api/v4/projects/group%2Fproject/merge_requests/42"

Some of its values, from GitLab's merge status list:

The list also has statuses for status checks, security policies, locked files and paths, a required Jira issue and a title pattern. Asking to merge automatically (auto_merge) instead merges it once the checks pass; it has a 405 of its own, see what auto-merge waits for.

On the merge request page the same checks are listed under Merge blocked: 1 check failed or Merge blocked: 3 checks failed, one line each (GitLab's constants.js):

When the merge itself fails

Some checks run only after you select Merge. GitLab then keeps the reason on the merge request, and the widget shows it in a red box with Try again. added, for example:

Branch has been updated since the merge was requested. Please review the changes. Try again.

The API returns the reason in the merge_error field of the merge request. The reasons, in the order GitLab checks them:

GitLab's merge_service.rb, from_source_branch.rb, ee/…/merge_base_service.rb and mr_widget_options.vue, read on November 3, 2026.

With push rules (GitLab Premium and Ultimate), GitLab checks the merge commit message and your commit email before the merge starts. A fast-forward merge makes no merge commit, so there only a squash commit message is checked. A mismatch shows in the same red box as one of Commit message does not follow the pattern '...', Commit message contains the forbidden pattern '...', Author's commit email '...' does not follow the pattern '...' or Commit message must contain a DCO signoff, with the rule's expression or your email in the quotes. When you squash, the squash commit message is checked too, for example Squash commit message does not follow the pattern '...'. Edit the merge commit message in the widget to match the rule, or add a Signed-off-by: line, then merge again (GitLab's merge_base_service.rb, merge_widget.vue and push rules).

The GraphQL mergeRequestAccept mutation checks four things first and returns the first that fails in errors: The merge request is already scheduled to be merged (auto-merge is already set), This branch cannot be merged (not mergeable now, or not eligible for the auto-merge strategy you asked for), Pre-merge hooks failed (the push rule check above) and The merge-head is not at the anticipated SHA (the sha you sent is not the head of the source branch). When these pass, the merge runs in the background and errors stays empty, so a later failure shows only in the mergeError field of the merge request (GitLab's accept.rb).

The /merge quick action needs the head SHA as well. Through the notes API, send it as merge_request_diff_head_sha. Without it, the summary of the answer says The `/merge` quick action requires the SHA of the head of the branch., and with an old one Branch has been updated since the merge was requested. Nothing is merged in either case (GitLab's merge_request_actions.rb and notes API).

Before a merge starts, the merge button can open Merge unverified changes? with The merge checks are incomplete because the latest pipeline failed, the pipeline status cannot be verified, or the merge request target branch was changed. You should run a new pipeline before merging. and Are you sure you want to attempt to merge? It comes when the latest pipeline failed or was canceled, or when GitLab moved the merge request to a new target branch. Run pipeline starts a new pipeline, and Merge unverified changes merges anyway. On a merge train the dialog is Start merge train instead (GitLab's merge_failed_pipeline_confirmation_dialog.vue and merge_widget.vue).

When the Resolve conflicts button is missing

The merge conflicts for this merge request cannot be resolved through GitLab. Please try to resolve them locally.
The merge conflicts for this merge request have already been resolved. Please return to the merge request.

On the merge check Merge conflicts must be resolved., GitLab shows Resolve locally, which opens the steps to check out and merge the branches on your machine, and Resolve conflicts, which opens the conflicts page. Resolve conflicts is there only when GitLab can resolve every conflicting file in the browser, you may push to the source branch, and the source branch is not protected. A file counts when it is a text file, not binary, under 200 KB with the conflict markers added, in UTF-8, and at the same path in both branches. When the project uses fast-forward merges or Merge commit with semi-linear history and the source branch must be rebased first, neither button is shown.

The conflicts page shows the first line above when a file breaks one of those rules, and the second when the merge request no longer conflicts. For someone who may not push to the source branch, the page is a 404. To resolve on your machine, merge the target branch into the source branch (or rebase onto it), fix the files, and push (GitLab's conflicts.vue, merge_request_presenter.rb, conflicts_controller.rb and parser.rb, and the resolve conflicts documentation).

If Commit to source branch on the conflicts page fails, GitLab shows an alert and commits nothing. From GitLab 19.1 the alert gives the server's words when there are any: the message of a push rule or server hook that refused the commit, or The merge conflicts for this merge request have already been resolved. when someone resolved them first. Otherwise it says Failed to save merge conflict resolutions. Please try again., and up to GitLab 18.4 it said Failed to save merge conflicts resolutions. Please try again! whatever the cause (GitLab's store/index.js and conflicts_controller.rb, merge request !236793).

What to do

In IntelliJ IDEA: "Review has conversations that must be resolved" and "Source branch must be rebased before merging"

The GitLab merge requests built into IntelliJ IDEA show these two lines in a merge request's status. In the source (checked October 30, 2026):

In IntelliJ IDEA: "All required checks have passed", "Checks in progress…" and "Checks failed"

The GitLab merge requests built into IntelliJ IDEA also put one line for the pipeline in a merge request's status, with a Details… link to its jobs. In the source (checked October 30, 2026), the line reads the jobs of the merge request's head pipeline (up to 1,000), and a job counts as required unless it is allowed to fail (allowFailure):

In IntelliJ IDEA: "Branch has conflicts that must be resolved"

The GitLab merge requests built into IntelliJ IDEA also show "Branch has conflicts that must be resolved" in a merge request's status, with a Resolve link. In the source (checked October 30, 2026), the line follows the merge status GraphQL gives (mergeStatusEnum): CANNOT_BE_MERGED ("There are conflicts between the source and target branches") shows it; CHECKING, UNCHECKED and CANNOT_BE_MERGED_RECHECK ("Currently unchecked. The previous state was CANNOT_BE_MERGED"), and the time before the details have loaded, show "Checking branch for conflicts" instead; CAN_BE_MERGED hides it (GitLab: MergeStatus; IntelliJ IDEA: GitLabResolveConflictsLocallyViewModel.kt, GitLabMergeRequestFullDetails.kt, GitLabMergeRequestDetailsStatusChecksComponentFactory.kt, CodeReviewDetailsStatusComponentFactory.kt). Resolve asks whether to rebase or merge, fetches the target branch, checks out the source branch (adding a remote for the source project when it is a fork your clone does not have yet), and then, in your local clone, rebases the source branch onto the target branch or merges the target branch into it. Any conflicts are then resolved in the IDE, and the merge request changes only when you push; after a rebase, that push has to be a force push (ResolveConflictsLocallyViewModel.kt). Resolve is greyed out, with the reason on it, while the repository is in the middle of a merge or a rebase ("Merge is already in progress"), when GitLab gives no source project ("The source project is private or does not exist"), and when the current branch already tracks the source branch and has the commit GitLab gives as the base of the diff (diffRefs baseSha, "Merge base of the branch the comment was made on") in its history ("Already resolved locally, push your changes to resolve") (CollaborationToolsBundle.properties, GitLabBundle.properties, GitLabResolveConflictsLocallyViewModel.kt).

GitLab merge requests in IntelliJ IDEA

Merge Request (MR) Review Inbox for GitLab, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, shows a merge request's merge checks before you merge: approvals, requested changes, unresolved threads, the pipeline, conflicts, and GitLab's other reasons from detailed_merge_status, with the ones that block the merge first. It merges the head commit you had on screen. When GitLab refuses, it says which case it is: for 405, that GitLab cannot merge it now and to see the merge checks; for 409, that the source branch changed and to refresh; for 422, that GitLab could not merge it, with GitLab's words; for 401, that your role or the project's settings may not allow it. When a rebase is needed, it offers one. Reading is free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).

Get it on JetBrains Marketplace

GITLAB is a trademark of GitLab Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitLab Inc. or JetBrains.

More: GitLab auto-merge refused (405) or canceled · GitLab 404 "Project Not Found" · GitLab "insufficient_scope" · GitLab 401 "invalid_token" · GitLab approval refused (401, 409) · GitLab comment or thread refused (400, 403) · GitLab merge request not created (409, 422, 400) · GitLab rebase refused or failed (403, 409) · GitLab merge request list refused (400, 404) · GitLab merge request changes cut short ("1000+", too_large) · GitLab 429 "Retry later" (rate limits) · GitLab merge refused or failed over squashing · GitLab "compare_timeout": true (diff limits) · GitLab merge request plugins for IntelliJ IDEA, compared · 日本語