-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Closed
Labels
bugSomething isn't workingSomething isn't workingneeds-triageneeds to be reviewedneeds to be reviewed
Description
Describe the bug
Running gh pr view 0 panic with the following output:
$ gh pr view 0
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x28 pc=0x1010c99e8]
goroutine 1 [running]:
github.com/cli/cli/v2/internal/ghrepo.IsSame({0x0, 0x0}, {0x0, 0x0})
github.com/cli/cli/v2/internal/ghrepo/repo.go:80 +0x28
github.com/cli/cli/v2/pkg/cmd/pr/shared.(*PullRequestRefs).GetPRHeadLabel(0x140007c16b8)
github.com/cli/cli/v2/pkg/cmd/pr/shared/finder.go:116 +0x34
github.com/cli/cli/v2/pkg/cmd/pr/shared.(*finder).Find(0x140008a8900, {{0x16f0f72f3, 0x1}, {0x103629240, 0x1c, 0x1c}, {0x0, 0x0}, {0x0, 0x0, ...}})
github.com/cli/cli/v2/pkg/cmd/pr/shared/finder.go:258 +0x107c
github.com/cli/cli/v2/pkg/cmd/pr/view.viewRun(0x14000680780)
github.com/cli/cli/v2/pkg/cmd/pr/view/view.go:98 +0x118
github.com/cli/cli/v2/pkg/cmd/pr/view.NewCmdView.func1(0x14000993b08, {0x1400086a030, 0x1, 0x101bfcfd1?})
github.com/cli/cli/v2/pkg/cmd/pr/view/view.go:69 +0x198
github.com/spf13/cobra.(*Command).execute(0x14000993b08, {0x1400086a010, 0x1, 0x1})
github.com/spf13/cobra@v1.8.1/command.go:985 +0x830
github.com/spf13/cobra.(*Command).ExecuteC(0x140005ea908)
github.com/spf13/cobra@v1.8.1/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/cli/cli/v2/internal/ghcmd.Main()
github.com/cli/cli/v2/internal/ghcmd/cmd.go:119 +0x4b0
main.main()
github.com/cli/cli/v2/cmd/gh/main.go:10 +0x1cAffected version
gh version 2.69.0 (2025-03-19)
https://github.com/cli/cli/releases/tag/v2.69.0
Steps to reproduce the behavior
gh pr view 0
Expected vs actual behavior
Expected to fail to lookup PR or fail on invalid PR value.
Logs
[git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x28 pc=0x1049ad9e8]
goroutine 1 [running]:
github.com/cli/cli/v2/internal/ghrepo.IsSame({0x0, 0x0}, {0x0, 0x0})
github.com/cli/cli/v2/internal/ghrepo/repo.go:80 +0x28
github.com/cli/cli/v2/pkg/cmd/pr/shared.(*PullRequestRefs).GetPRHeadLabel(0x1400098f6b8)
github.com/cli/cli/v2/pkg/cmd/pr/shared/finder.go:116 +0x34
github.com/cli/cli/v2/pkg/cmd/pr/shared.(*finder).Find(0x140006dc380, {{0x16b8132e3, 0x1}, {0x106f0d240, 0x1c, 0x1c}, {0x0, 0x0}, {0x0, 0x0, ...}})
github.com/cli/cli/v2/pkg/cmd/pr/shared/finder.go:258 +0x107c
github.com/cli/cli/v2/pkg/cmd/pr/view.viewRun(0x14000133b60)
github.com/cli/cli/v2/pkg/cmd/pr/view/view.go:98 +0x118
github.com/cli/cli/v2/pkg/cmd/pr/view.NewCmdView.func1(0x14000788f08, {0x1400059e450, 0x1, 0x1054e0fd1?})
github.com/cli/cli/v2/pkg/cmd/pr/view/view.go:69 +0x198
github.com/spf13/cobra.(*Command).execute(0x14000788f08, {0x1400059e430, 0x1, 0x1})
github.com/spf13/cobra@v1.8.1/command.go:985 +0x830
github.com/spf13/cobra.(*Command).ExecuteC(0x1400077e908)
github.com/spf13/cobra@v1.8.1/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/cli/cli/v2/internal/ghcmd.Main()
github.com/cli/cli/v2/internal/ghcmd/cmd.go:119 +0x4b0
main.main()
github.com/cli/cli/v2/cmd/gh/main.go:10 +0x1c
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds-triageneeds to be reviewedneeds to be reviewed