jesseduffield/lazygit · warning
No pull request found for this branch
Error message
No pull request found for this branch
What it means
Returned by LocalCommitsController.openPRInBrowser when the checked-out branch has no entry in Model().PullRequestsMap. Normally the action is disabled via a DisabledReason returning NoPullRequestForBranch with ShowErrorInPanel, but this defensive error covers the race where a background PR refresh removed the entry between the enable-check and the keypress.
Source
Thrown at pkg/gui/controllers/local_commits_controller.go:679
}
return bindings
}
func (self *LocalCommitsController) checkedOutBranchHasPR() *types.DisabledReason {
branch := self.c.Model().CheckedOutBranch
if _, ok := self.c.Model().PullRequestsMap[branch]; !ok {
return &types.DisabledReason{Text: self.c.Tr.NoPullRequestForBranch, ShowErrorInPanel: true}
}
return nil
}
func (self *LocalCommitsController) openPRInBrowser() error {
pr, ok := self.c.Model().PullRequestsMap[self.c.Model().CheckedOutBranch]
if !ok {
// Should be guarded against by the DisabledReason check, but be defensive in case
// PullRequestsMap was updated concurrently by a background refresh
return errors.New(self.c.Tr.NoPullRequestForBranch)
}
self.c.LogAction(self.c.Tr.Actions.OpenPullRequest)
return self.c.OS().OpenLink(pr.Url)
}
func (self *LocalCommitsController) GetOnRenderToMain() func() {
return func() {
self.c.Helpers().Diff.WithDiffModeCheck(func() {
var task types.UpdateTask
commit := self.context().GetSelected()
if commit == nil {
task = types.NewRenderStringTask(self.c.Tr.NoCommitsThisBranch)
} else if commit.Action == todo.UpdateRef {
task = types.NewRenderStringTask(
utils.ResolvePlaceholderString(
self.c.Tr.UpdateRefHere,View on GitHub (pinned to c477a2959b)
Solutions
- Verify the branch actually has an open PR on the hosting service; create one if not.
- Wait for the pull-request refresh to complete (or trigger a refresh) and retry.
- Check git.logLevel / services config if PR fetching consistently fails (token, host config).
- As a developer, keep the DisabledReason guard and this defensive check paired — do not remove the map lookup before OpenLink.
Defensive patterns
Strategy: validation
Validate before calling
pr, ok := self.c.Model().PullRequestsMap[self.c.Model().CheckedOutBranch]
if !ok {
// treat as no PR: disable action or prompt to create one
return nil
}
_ = pr Prevention
- Keep the DisabledReason check (with ShowErrorInPanel) as the primary gate for the open-PR action.
- Treat a missing map entry as 'create PR' UX rather than an error where possible.
- Trigger a PR refresh when the branch changes so the map is populated before the user acts.
When it happens
Trigger: Pressing the open-PR key when PullRequestsMap[CheckedOutBranch] is absent — either the branch genuinely has no PR, or a concurrent background fetch of pull requests has not (yet) populated or has cleared the map.
Common situations: Github/GitLab integration enabled but PR data still loading or fetch failed silently; branch's PR was just closed/merged; timing window between the disabled-check and the handler running.
Related errors
- Cannot open a pull request for a branch with no upstream
- This branch doesn't exist on remote. You need to push it to
- No pull request found for this branch
- GraphQL query failed with status: %s. Body: %s
- A remote named '%s' does not exist
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/98d1102c1d65887a.
Report an issue: GitHub.