Visitar URL original
`gh pr view` panics when a pull request with more than 100 status checks stops resolving mid-request · Issue #14989 · cli/cli · GitHub
Skip to content

gh pr view panics when a pull request with more than 100 status checks stops resolving mid-request #14989

Open

Description

@daniellockyer

Describe the bug

gh pr view crashes with a panic when a pull request has more than 100 status checks and the pull request stops resolving between the two API requests that gh makes to collect them.

The check contexts of a pull request are paginated, so gh makes a second request for the remaining contexts. The second response is read without checking that the pull request it refers to is still there, which produces either a nil pointer dereference or an index out of range error.

Affected version

$ gh version
gh version 2.103.3-71-g736c68f67 (2026-11-07)
https://github.com/cli/cli/releases/latest

This is a build of trunk.

Steps to reproduce the behavior

  1. Open a pull request that has more than 100 status checks, for example one that runs a large CI matrix.

  2. While gh pr view is running, make the pull request stop resolving. For example, delete the head branch or the pull request itself.

  3. Run:

    gh pr view <number>
    
  4. View the output

  5. See error

The crash also happens if the pull request still resolves but the list of commits comes back empty, which gives an index out of range error instead of a nil pointer dereference.

gh pr view --json statusCheckRollup reaches the same code.

Expected vs actual behavior

Expected: gh should report that the pull request's checks could not be read, the way it reports other failures while collecting a pull request's data.

Actual: gh panics and exits with status 2.

Logs

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x228 pc=0xd78d54]

goroutine 72 [running]:
github.com/cli/cli/v2/pkg/cmd/pr/shared.preloadPrChecks(0xed5071ec210, {0x29538a0, 0xed5071ec180}, 0xed506c49008)
	github.com/cli/cli/v2/pkg/cmd/pr/shared/finder.go:600 +0x2b4
github.com/cli/cli/v2/pkg/cmd/pr/shared.(*finder).Find.func4()
	github.com/cli/cli/v2/pkg/cmd/pr/shared/finder.go:284 +0x27
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/sync@v0.24.0/errgroup/errgroup.go:93 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
	golang.org/x/sync@v0.24.0/errgroup/errgroup.go:78 +0xa5
...
exit status 2

With an empty commit list instead of a missing pull request, the panic is:

panic: runtime error: index out of range [0] with length 0

goroutine 72 [running]:
github.com/cli/cli/v2/pkg/cmd/pr/shared.preloadPrChecks(0xed5071ec210, {0x29538a0, 0xed5071ec180}, 0xed506c49008)
	github.com/cli/cli/v2/pkg/cmd/pr/shared/finder.go:600 +0x426
github.com/cli/cli/v2/pkg/cmd/pr/shared.(*finder).Find.func4()
	github.com/cli/cli/v2/pkg/cmd/pr/shared/finder.go:284 +0x27
...
exit status 2

Activity

  1. cli-triage commented on Nov 7, 2026

    @cli-triage

    Reproducible on 2.103.3.

    Using test data where the first response reports another page of status checks and the next response no longer contains the pull request:

    $ gh pr view 1 -R example.invalid/hello
    panic: runtime error: invalid memory address or nil pointer dereference

    Exit status: 2.

    The latest release and source snapshot at 736c68f674113337685e3eb1f908602a03b8f99b behave the same way. The paginated response is read without first checking that the pull request node and latest commit are present. gh should return a normal error instead of panicking.

    Supporting reports

    Generated by issue triage.

  2. added
    bugSomething isn't working
    priority-3Affects a small number of users or is largely cosmetic
    gh-prrelating to the gh pr command
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-prrelating to the gh pr commandpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions