Improve vague error message when automatic rebase before merge fails

Summary

When the "rebase before merge" feature (behind the rebase_on_merge_automatic flag, see #524048 (closed)) fails during the automatic rebase step of a merge, the UI shows only a generic "An error occurred while merging. Try again." message. A customer reported this in #524048 (comment 3687401486): retrying the merge repeatedly did not help, and they were only unblocked by disabling automatic rebase and switching to the merge commit method. A second developer hit the same issue and got unblocked by rebasing manually, suggesting the real cause was a rebase conflict, but the error message gave no indication of that.

Proposal

  • Investigate where the generic "An error occurred while merging. Try again." message originates in the merge flow.
  • Identify why a failure in the automatic rebase step is not distinguished from other merge failures before reaching the user.
  • Update the error message so that when the automatic rebase fails, it states the rebase failed (and the reason, e.g. a conflict, if available) and suggests next steps, such as rebasing locally or resolving conflicts.