Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

unstack shows a generic/incorrect error instead of the real API rejection reason

オープン
#372 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
67/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
github, go
領域
api, cli

調査の方向性

まず、pull request がマージされた stack 上で gh stack unstack <number> を再現し、通常の出力と GH_DEBUG=api の出力を比較します。unstack のエラー処理と REST API の 422 レスポンスを追跡します。完了の条件は、デバッグなしの出力が、関連のない queued-for-merge メッセージではなく、実際の拒否理由を報告することです。

索引モデルが issue の本文から書いたものです。

説明

bug topic: stack management

Summary

gh stack unstack <number> fails on a stack containing merged PRs, but the plain (non-debug) error message names an unrelated cause. The actual server-side reason is only visible with GH_DEBUG=api.

Repro

  1. Create a stack with gh stack link (or submit), e.g. main <- a <- b <- c <- d <- e.
  2. Merge a and b (via merge queue or a normal merge — doesn't matter which).
  3. Run gh stack unstack <number> on that stack.

Actual

⚠ Some pull requests are queued for merge or have auto-merge enabled and remain stacked on GitHub
The stack was left in place — local tracking is unchanged

I verified via gh api graphql that none of the stack's PRs had autoMergeRequest set or a mergeQueueEntry — so the stated reason doesn't match reality.

Running the identical command with GH_DEBUG=api gh stack unstack <number> shows the real HTTP exchange:

POST /repos/{owner}/{repo}/stacks/{id}/unstack
< HTTP/2.0 422 Unprocessable Entity
{
  "message": "Pull requests #.. , #.. cannot be removed from this stack",
  "documentation_url": "https://docs.github.com/rest/pulls/stacks#remove-pull-requests-from-a-pull-request-stack",
  "status": "422"
}

Interestingly, in the GH_DEBUG=api run the CLI's own final stderr line correctly echoed this specific message (✗ Unstacking not allowed: Pull requests #.., #.. cannot be removed from this stack) — a materially different, and accurate, explanation compared to the generic message shown without debug logging.

Expected

The non-debug error message should reflect the actual REST API rejection (a stack can't be unstacked once any of its PRs have merged), not a generic, unrelated "queued for merge / auto-merge enabled" message.

Environment

gh-stack version 0.0.8, installed via gh extension install github/gh-stack.

主要言語
Go
スター
1.5k
フォーク
73
平均マージ
1日 8時間
マージ済み PR(30日)
7

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

github/gh-stack のほかの issue

github/gh-stack の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。