Skip to content

gh pr view --json "stateReason" panics #9301

@barrettj12

Description

@barrettj12

Describe the bug

gh pr view --json "stateReason" panics - see the logs below. gh version 2.52.0.
On my local branch tracking this branch: https://github.com/tlm/juju/tree/container-manager-service

Steps to reproduce the behavior

gh pr view --json "stateReason"

Expected vs actual behavior

Expected: json output
Obtained: panic

Logs

$ gh pr view --json "stateReason"
panic: reflect: call of reflect.Value.Interface on zero Value

goroutine 1 [running]:
reflect.valueInterface({0x0?, 0x0?, 0x0?}, 0x0?)
        /opt/hostedtoolcache/go/1.22.4/x64/src/reflect/value.go:1501 +0xfb
reflect.Value.Interface(...)
        /opt/hostedtoolcache/go/1.22.4/x64/src/reflect/value.go:1496
github.com/cli/cli/v2/api.(*PullRequest).ExportData(0xc000735888, {0xc0007e86f0, 0x1, 0x30?})
        /home/runner/work/cli/cli/api/export_pr.go:144 +0x968
github.com/cli/cli/v2/pkg/cmdutil.(*jsonExporter).exportData(0xc00039c200, {0x16dd960?, 0xc000735888?, 0x16c0d00?})
        /home/runner/work/cli/cli/pkg/cmdutil/json_flags.go:259 +0x52a
github.com/cli/cli/v2/pkg/cmdutil.(*jsonExporter).exportData(0xc00039c200, {0x162c9a0?, 0xc000735888?, 0x3ff0000000000000?})
        /home/runner/work/cli/cli/pkg/cmdutil/json_flags.go:239 +0x3ac
github.com/cli/cli/v2/pkg/cmdutil.(*jsonExporter).Write(0xc00039c200, 0xc0004b1a20, {0x162c9a0, 0xc000735888})
        /home/runner/work/cli/cli/pkg/cmdutil/json_flags.go:205 +0x11c
github.com/cli/cli/v2/pkg/cmd/pr/view.viewRun(0xc000415e60)
        /home/runner/work/cli/cli/pkg/cmd/pr/view/view.go:121 +0x3f5
github.com/cli/cli/v2/pkg/cmd/pr/view.NewCmdView.func1(0xc000738008, {0xc000480480, 0x0, 0x16e99c9?})
        /home/runner/work/cli/cli/pkg/cmd/pr/view/view.go:69 +0x349
github.com/spf13/cobra.(*Command).execute(0xc000738008, {0xc000480460, 0x2, 0x2})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc000209808)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1050
main.mainRun()
        /home/runner/work/cli/cli/cmd/gh/main.go:119 +0x53b
main.main()
        /home/runner/work/cli/cli/cmd/gh/main.go:46 +0x13

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageneeds to be reviewed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions