Skip to content

GitHub PR fetch cannot be disabled, causes 401 errors when switching submodules #5516

@minhchu

Description

@minhchu

Is your feature request related to a problem? Please describe.

When working in a monorepo with submodules, lazygit attempts to fetch GitHub PRs via the GraphQL API every time you switch between submodules or lazygit receives focus. If the gh CLI has an expired token (while git SSH still works fine), this produces a repeated error on every switch:

Error fetching pull requests from GitHub: GraphQL query failed with status: 401 Unauthorized. Body: {
  "message": "Bad credentials",
  "documentation_url": "https://docs.github.com/rest",
  "status": "401"
}
Image

The code only skips PR fetching if GetAuthToken() returns an empty string, but an expired gh token returns a non-empty invalid token, so the early-exit check is bypassed.

Describe the solution you'd like

Add a git.showGithubPullRequests config option (default true) and guard refreshGithubPullRequests() with it, so users who don't use the PR feature can opt out entirely.

Describe alternatives you've considered

No.

Additional context

  • lazygit version: 0.61.1
  • OS: macOS
  • Use case: monorepo with submodules, git SSH auth works, gh token expired

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions