[Bug]: Pull Requests page fails with "GitHub CLI command failed" when gh uses a GitHub App installation token
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 86/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- github, graphql, typescript
Research direction
Start in apps/server/src/pullRequest/GitHubPullRequestCli.ts at getViewerLogin, and compare the failing gh api user call with the working gh api graphql viewer command from the report. Reproduce with a GitHub App installation token and open the Pull Requests page. Done means the page lists pull requests and the viewer login supports the generated author and review-requested qualifiers.
Written by the indexing model from the issue text.
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Authenticate
ghwith a GitHub App installation token (ghs_…), e.g.gh auth login --with-tokenon a machine where a bot account runs the T3 Code server.gh auth statusreports it as logged in, andgh pr listworks. - Run
t3 serveand add a GitHub repository as a project. - Open the Pull Requests page.
Expected behavior
Pull requests are listed. Everything the listing itself runs (gh pr list --json …, gh repo view --json …) succeeds with this token.
Actual behavior
The page shows Could not load pull requests: Pull request operation list failed: GitHub CLI command failed. Retry fails the same way.
Before listing anything, GitHubPullRequestCli.getViewerLogin runs:
github.execute({ cwd: input.cwd, args: ["api", "user", "--jq", ".login"] })
GitHub doesn't allow installation tokens to call REST GET /user:
$ gh api user --jq .login
{"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/users/users#get-the-authenticated-user","status":"403"}
gh: Resource not accessible by integration (HTTP 403)
So getViewer fails and the whole pullRequests.list fails with it. The 403 message doesn't appear in the UI or the trace; only "GitHub CLI command failed" does.
GraphQL viewer works with the same token, and returns the login a user token would get from /user:
$ gh api graphql -f 'query={viewer{login}}' --jq .data.viewer.login
<app-slug>[bot]
The login it returns also works in the qualifiers the listing builds (author:<app-slug>[bot], review-requested:…).
Suggested fix: in getViewerLogin, use ["api", "graphql", "-f", "query={viewer{login}}", "--jq", ".data.viewer.login"] instead of ["api", "user", …]. I patched the 0.0.40 build this way and the page loads.
Impact
Minor bug or occasional failure
Only the Pull Requests page is affected, but on that page it fails every time.
Version or commit
v0.0.40. The same getViewerLogin call is still on main (apps/server/src/pullRequest/GitHubPullRequestCli.ts).
Environment
NixOS, t3 serve --mode web, Node 24.19.0, gh 2.100.0, authenticated as a GitHub App installation (ghs_ token)
Logs or stack traces
PullRequestOperationError: Pull request operation list failed: GitHub CLI command failed.
[cause]: PullRequestProviderError: github failed in getViewer: GitHub CLI command failed.
[cause]: GitHubCliCommandError: GitHub CLI failed in execute: GitHub CLI command failed.
[cause]: VcsProcessExitError: VCS process failed in GitHubCli.execute: gh (/path/to/repo) exited with 1 - Process exited with a non-zero status.
Workaround
Patch getViewerLogin to use the GraphQL viewer query shown above, or authenticate gh with a user token instead of an app installation token.
- Dominant language
- TypeScript
- Stars
- 23.3k
- Forks
- 6k
- Avg merge
- 10h 57m
- Merged PRs (30d)
- 365
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pingdotgg/t3code
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
accepted bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
accepted bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
accepted bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
All issues in pingdotgg/t3code
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·