You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Panic in gh pr view --comments due to nil pointer dereference in project items #12325
bugSomething isn't workinggh-prrelating to the gh pr commandneeds-triageneeds to be reviewedpriority-2Affects more than a few users but doesn't prevent core functions
When running gh pr view <number> --comments, the CLI panics with a runtime error: invalid memory address or nil pointer dereference.
This occurs in api/queries_projects_v2.go when processing projectItems. It appears the GraphQL API is returning null nodes in the projectItems connection, which the client does not check before dereferencing.
I observed this even when using a personal access token with full read-only access to all scopes, so I don't think this is a permission issue.
Affected version
$ gh version
gh version 2.83.1-68-g51dfeeaa7 (2025-12-16)
https://github.com/cli/cli/releases/latest
Can you please try upgrading to v2.83.2 (current latest) and run again? And if you still see failures please share these as well (redact where needed):
gh auth status --json hosts (to make sure your OAuth scopes are rightly set)
I haven't yet fully reviewed your PR because I need to make sure about a some details. It's probably what you have already mentioned, the nil items, but the debug logs will help us better understand the problem and if should be fixed in other commands.
Thanks for taking a look @babakks . I downloaded the latest release and tested again with that version.
$ ./gh_2.83.2_linux_amd64/bin/gh version
gh version 2.83.2 (2025-12-10)
https://github.com/cli/cli/releases/tag/v2.83.2
Unfortunately, I still experience the same panic on this version. Please see this gist for the debug logs.
Thanks, @chrishenzie! It appears the projectItems field is returning a null node, which causes the panic trying to dereference within the following loop:
I've opened #12356 as I suspect permissions are preventing this v2 project items to being returned, requiring the gh code to skip them gracefully like we do in a few other places.
bugSomething isn't workinggh-prrelating to the gh pr commandneeds-triageneeds to be reviewedpriority-2Affects more than a few users but doesn't prevent core functions
Activity
babakks commentedon Dec 17, 2025
Thanks for reporting this and the PR, @chrishenzie! 🍻
I cannot reproduce it on my end, probably because you have access to private/internal projects associated with this PR that I don't have.
Can you please try upgrading to
v2.83.2(current latest) and run again? And if you still see failures please share these as well (redact where needed):DEBUG=api gh pr view 5475 --repo kubernetes/enhancementsgh auth status --json hosts(to make sure your OAuth scopes are rightly set)I haven't yet fully reviewed your PR because I need to make sure about a some details. It's probably what you have already mentioned, the
nilitems, but the debug logs will help us better understand the problem and if should be fixed in other commands.chrishenzie commentedon Dec 17, 2025
Thanks for taking a look @babakks . I downloaded the latest release and tested again with that version.
Unfortunately, I still experience the same panic on this version. Please see this gist for the debug logs.
$ ./gh_2.83.2_linux_amd64/bin/gh auth status --json hosts { "hosts": { "github.com": [ { "state": "success", "active": true, "host": "github.com", "login": "chrishenzie", "tokenSource": "<REDACTED_HOME_DIR>/.config/gh/hosts.yml", "gitProtocol": "ssh" } ] } }Enhance v2 project handling around nulls
andyfeller commentedon Dec 22, 2025
Thanks, @chrishenzie! It appears the
projectItemsfield is returning anullnode, which causes the panic trying to dereference within the following loop:{ "data": { "repository": { "pullRequest": { "projectItems": { "totalCount": 1, "nodes": [ null ], "pageInfo": { "hasNextPage": false, "endCursor": "MQ" } } } } } }cli/api/queries_projects_v2.go
Lines 170 to 189 in baf6299
Expand for the full debug log entry
I've opened #12356 as I suspect permissions are preventing this v2 project items to being returned, requiring the
ghcode to skip them gracefully like we do in a few other places.