"Reference is not a tree" after disabling merge trains after it was enabled

As shown in gitlab-com/www-gitlab-com#5177 (closed), we enabled merge trains and then disabled it later.

After we disabled it, merge requests (e.g. gitlab-com/www-gitlab-com!29607 (merged)) that were added to the train couldn't be merged because builds were failing with:

Checking out 25a401dc as refs/merge-requests/29607/merge...
fatal: reference is not a tree: 25a401dcac0abcca9eba17b20d099302008243b6

To recover, we had to push a new commit or rebased master.

I also noticed merge requests that had the added to the train text in the merge button text didn't automatically update until I cancelled it.

@dosuken123 Is this expected? Is there a more graceful recovery mechanism here?

Edited by Stan Hu