`gh issue develop --name <existing-branch>` fails with "API returned empty branch name" instead of saying the branch already exists
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Bắt đầu bằng cách lần theo lệnh gh issue develop --name đến mutation createLinkedBranch và kiểm tra cách phản hồi được xử lý khi linkedBranch là null. Thêm giải thích hữu ích cho trường hợp này và kiểm tra các bài kiểm thử lệnh hiện có về việc tạo nhánh và xử lý lỗi. Công việc được xem là hoàn tất khi thao tác thử dùng một nhánh remote hiện có báo nguyên nhân thay vì “API returned empty branch name.”
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
When --name is a branch that already exists on the remote, gh issue develop fails with:
failed to create linked branch: API returned empty branch name
The message points at the API response, not the cause. The underlying createLinkedBranch mutation returns HTTP 200 with {"data":{"createLinkedBranch":{"linkedBranch":null}}} and no errors, and nothing is linked or created.
This is likely the real cause behind #13805, which was closed without a reproduction: that report blamed the slash in the branch name, but the test below shows an existing branch fails with or without a slash, and a new branch with a slash works.
Affected version
gh version 2.92.0 (2026-04-28), Linux
Steps to reproduce the behavior
- In any repository, push two branches:
exampleandfeat/example. - Open an issue.
- Run
gh issue develop <issue> --repo <owner>/<repo> --name example --base example. - See
failed to create linked branch: API returned empty branch name.gh issue develop --list <issue>shows nothing linked. - Repeat with
--name feat/example --base feat/example: same error. - Run
gh issue develop <issue> --repo <owner>/<repo> --name feat/new-example --base main: the branch is created and linked.
Tested
Private repository, gh 2.92.0, every branch pointing at the same main commit:
Branch passed to --name |
Already on remote? | Result |
|---|---|---|
example |
yes | API returned empty branch name, exit 1, nothing linked |
feat/example |
yes | API returned empty branch name, exit 1, nothing linked |
feat/new-example |
no | branch created and linked (--list shows it) |
Request ID of a failing mutation (from GH_DEBUG=api): DB0E:26CBEE:1EB28F1:2CA6176:6AEC648D
The third run was made outside a git checkout, so it also exited 1 with fatal: not in a git directory after creating the branch; that is #14856.
Expected vs actual behavior
Expected: before calling createLinkedBranch, check whether the branch already exists and say so, for example "branch example already exists; the API can only link a new branch. Link it from the issue's Development sidebar." Or check for a null linkedBranch and explain it.
Actual: a generic "empty branch name" error.
Additional context
The API side (no way to link an existing branch, and the silent null) is reported in https://github.com/orgs/community/discussions/212130.
- Ngôn ngữ chính
- Go
- Star
- 46.9k
- Fork
- 9.2k
- Merge trung bình
- 1 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 60
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cli/cli
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows needs-triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug gh-repo priority-3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: cover gh api mutation pitfalls in the gh skillCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởenhancement
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
enhancement needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
valkey-io/valkey-operator#610 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
WriterSetTimes: the UTIME_NOW check fails when the kernel uses its coarse clockCó thể đã có người làm @JakeChampion đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
JakeChampion/lang#14224 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs(reference): pi stream-filter bullet says tool_execution_update passes through unchangedĐang mởagent-butler-finding bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
jordansmall/spindrift#6391 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Default alertmanager drop event thresholds parse into a single invalid thresholdCó thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mởneeds-kind
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
falcosecurity/falcosidekick#1476 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày