From 60992fd8d890a86be800781d962bfba033dc0435 Mon Sep 17 00:00:00 2001 From: Gildas Garcia <1122076+djhi@users.noreply.github.com> Date: Tue, 7 Apr 2026 20:13:09 +0200 Subject: [PATCH] fix: show API error message when an error occurs during branch creation (#44638) ## Problem When a user creates a branch but their GitHub account does not have access to the repo, the UI shows a generic branch not found message. ## Solution The API actually returns a more detailed message. Show it instead of the generic one. ## Summary by CodeRabbit * **Bug Fixes** * Fixed error message handling when creating branches from invalid Git references. Users will now receive appropriate error messages when attempting to use a non-existent branch. --- .../interfaces/BranchManagement/CreateBranchModal.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx index 15387a935c6..8df89e74b80 100644 --- a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx +++ b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx @@ -254,8 +254,9 @@ export const CreateBranchModal = () => { if (form.getValues('gitBranchName') !== branchName) return setIsGitBranchValid(false) form.setError('gitBranchName', { - ...error, - message: `Unable to find branch "${branchName}" in ${repoOwner}/${repoName}`, + message: + error?.message ?? + `Unable to find branch "${branchName}" in ${repoOwner}/${repoName}`, }) }, }