Skip to content

"Source branch does not exist" when it actually exists

Summary

MR widget displays Source branch does not exist. Please restore it or use a different source branch when the branch actually exists. The same MR displays the diff correctly, and the branch is visible when browsing the repository through the UI.

Steps to reproduce

It's not clear how the issue can be reproduced consistently, but the flow is usually something like this:

  1. git switch -c <branch> locally.
  2. Stage some files, and make a commit.
  3. Push the branch to the GitLab remote.
  4. Open an MR.

https://gitlab.com/gitlab-org/gitlab/-/issues/439613 (confidential customer issue) has some logs which may be relevant.

Example Project

See the details in this internal ticket: https://gitlab.zendesk.com/agent/tickets/256583

What is the current bug behavior?

Merge Request cannot be merged because it erroneously displays Source branch does not exist. Please restore it or use a different source branch

What is the expected correct behavior?

Merge button should be active and there should be no Source branch does not exist. Please restore it or use a different source branch message.

Summary of findings so far

There doesn't appear to be a single root cause for this issue. The investigation is made particularly difficult due to the variety of GitLab versions (15 through 17), configurations, and repositories in use. More recent reports of the issue are limited to self-managed installations; the problem has not recently manifested on GitLab.com.

Users have had varying success addressing the problem with the following remedies:

Edited by James Liu