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

GitLab: why the rebase did not happen

Rebasing a merge request through the API (PUT /projects/:id/merge_requests/:merge_request_iid/rebase) is refused at once with 403 or 409, or answers 202, which only means that GitLab has queued the rebase: it runs afterwards and can still fail. All of this is from GitLab's source (the rebase endpoint in lib/api/merge_requests.rb, MergeRequests::RebaseService, and rebase_async in app/models/merge_request.rb), read on October 24, 2026.

The answers

After the 202 ({"rebase_in_progress":true}), a rebase that fails leaves its reason in the merge request's merge_error:

GitLab also writes a failed merge there. merge_error stays until the next push to the source branch, or until the merge request is closed or merged.

On the merge request page, GitLab drops the final period of merge_error and adds . Try again., whatever the cause (GitLab's mr_widget_options.vue), so the page reads Rebase failed: Rebase locally, resolve all conflicts, then push the branch. Try again. It does not mean that the same rebase will work a second time. With conflicts, rebase locally as below.

A token without the api scope is refused with 403 too, but that answer says insufficient_scope; see which scope to add. A project path that does not exist, or that you cannot see, answers 404; see address or permission.

To rebase from the IDE: Merge Request (MR) Review Inbox for GitLab, a plugin for JetBrains IDEs, offers to rebase the source branch when GitLab says the merge request needs it, and from version 1.0.14 shows what GitLab put in merge_error when the rebase fails afterwards.

Where it stands

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

While rebase_in_progress is true, the rebase is still queued or running. Once it is false, merge_error is null if the rebase worked, or says why it failed. state tells whether the merge request is still open. Use your own server's address instead of gitlab.com.

The /rebase quick action

A comment with /rebase asks for the same rebase. GitLab offers the command only when the merge request is open, its source branch exists and you may push to that branch. It then checks these in order and answers with one of them:

If the same comment also holds /merge, GitLab drops the merge so that it does not race the rebase. Through the notes API, a note that holds only /rebase is answered with 202, and the sentence is in summary (GitLab's merge_request_actions.rb, update_service.rb and notes_helpers.rb, read on November 3, 2026).

The Rebase button

The Rebase button on the merge request page runs the same checks as the API, in this order, before it queues anything. When one fails, GitLab shows an alert at the top of the page:

Failed to rebase: Source branch does not exist.
Failed to rebase: Cannot push to source branch.
Failed to rebase: Source branch is protected from force push.
Failed to rebase: Failed to enqueue the rebase operation, possibly due to a long-lived transaction. Try again later.

They mean the same as the 403 and 409 answers above. Failed to rebase. Please try again. comes when the answer carries no reason, such as a server error. When the rebase has run and worked, a short Rebase completed message shows; when it failed, the red box shows merge_error as described above. Something went wrong. Please try again. means the page could not read the merge request's state while it waited (GitLab's merge_requests_controller.rb, rebase_service.rb, rebase.vue and utils.js, read on November 3, 2026).

The page has a second Rebase button, and the first one can come with a choice. Under the merge details, The source branch is 3 commits behind the target branch. has a Rebase source branch link for anyone who may push to the source branch. It first asks Rebase source branch? with This will rebase all commits from the source branch onto the target branch. and after Rebase it shows Scheduled a rebase of branch feature. When the project rebases automatically before merge and has no merge trains, the link reads Rebase with pipeline, and the line below says Source branch will be rebased without pipeline. In the merge checks, Rebase without pipeline sits next to Rebase when you may push to the source branch and the project does not require a successful pipeline, or also counts a skipped pipeline as successful. It is the API's skip_ci=true, so no pipeline runs for the rebased branch. On a merge request from a fork, when you can run pipelines in the parent project and the latest pipeline did not run there, Rebase first asks Are you sure you want to rebase? The new pipeline would run the fork's code, and the warning says CI variables could be exposed (GitLab's merge_widget.vue, rebase_confirmation_dialog.vue, checks/rebase.vue and merge_request_poll_widget_entity.rb).

What to do

GitLab merge requests in IntelliJ IDEA

Merge Request (MR) Review Inbox for GitLab, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, offers to rebase the source branch when GitLab says the merge request needs a rebase. When GitLab answers 403, it says that your role in the project or its settings may not let your account do it, with GitLab's words; other refusals in GitLab's words. After the 202, it says that GitLab is rebasing the branch and to refresh in a moment; from version 1.0.14, when the rebase fails afterwards, the overview shows what GitLab put in merge_error, until the branch is pushed again or the merge request can be merged. Reading is free; rebasing, 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 merge refused (405, 409, 422) · GitLab auto-merge refused (405) or canceled · GitLab approval refused (401, 409) · GitLab comment or thread refused (400, 403) · GitLab merge request not created (409, 422, 400) · GitLab "insufficient_scope" · GitLab 401 "invalid_token" · GitLab 404 "Project Not Found" · 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 · 日本語