jesseduffield/lazygit · warning
No pull request found for this branch
Error message
No pull request found for this branch
What it means
Thrown by BranchesController.openPRInBrowser when the branch name has no entry in Model().PullRequestsMap. lazygit looks up the PR associated with the branch (from the hosting-service integration, e.g. GitHub/GitLab PR loading) to get its URL; normally the associated keybinding is disabled with a DisabledReason when no PR exists, so this error is the defensive backstop for a race with a concurrent background refresh of the PR list.
Source
Thrown at pkg/gui/controllers/branches_controller.go:902
}
return nil
}
func (self *BranchesController) branchHasPR(branch *models.Branch) *types.DisabledReason {
if _, ok := self.c.Model().PullRequestsMap[branch.Name]; !ok {
return &types.DisabledReason{Text: self.c.Tr.NoPullRequestForBranch, ShowErrorInPanel: true}
}
return nil
}
func (self *BranchesController) openPRInBrowser(branch *models.Branch) error {
pr, ok := self.c.Model().PullRequestsMap[branch.Name]
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 *BranchesController) branchesAreReal(selectedBranches []*models.Branch, startIdx int, endIdx int) *types.DisabledReason {
if !lo.EveryBy(selectedBranches, func(branch *models.Branch) bool {
return branch.IsRealBranch()
}) {
return &types.DisabledReason{Text: self.c.Tr.SelectedItemIsNotABranch}
}
return nil
}
func (self *BranchesController) notMergingIntoYourself(branch *models.Branch) *types.DisabledReason {View on GitHub (pinned to c477a2959b)
Solutions
- Refresh lazygit (press 'r' / '@') so PullRequestsMap reloads, then retry
- Check that the hosting service integration is configured (e.g. GitHub token in config) so PRs are actually fetched
- If no PR exists yet, create one via the create-PR action instead of open-in-browser
Defensive patterns
Strategy: try-catch
Validate before calling
// Check the map before opening the browser (the same lookup openPRInBrowser does):
if _, ok := guiModel.PullRequestsMap[branch.Name]; !ok {
// no PR loaded: refresh or create one instead
return refreshOrOfferCreate(branch)
} Try / catch
// In Go, treat this as a recoverable miss, not a hard failure:
pr, ok := model.PullRequestsMap[branch.Name]
if !ok {
// DisabledReason normally prevents this; retry after a refresh
refreshAndWait()
if pr, ok = model.PullRequestsMap[branch.Name]; !ok {
return errors.New("no pull request found for this branch")
}
} Prevention
- Disable the open-PR action when the map lacks the branch (lazygit already does this via DisabledReason)
- Trigger a PullRequestsMap refresh before exposing PR actions
- Configure the hosting-service integration so PR data is actually fetched
When it happens
Trigger: Invoking 'open PR in browser' on a branch whose PR entry is absent — because no PR exists, the hosting integration is not configured/no token, or the PullRequestsMap refresh removed/has not yet loaded the entry between the disabled-check and the press.
Common situations: Branch with an open PR but lazygit's PR fetching is not running (no hosting service config), stale model right after opening/closing a PR on the website, or pressing the key exactly as a background refresh swaps the map.
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
- A remote named '%s' does not exist
- Git version must be at least %s. Please upgrade your git ver
- Lazygit does not support bare repos.
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/979a4d6a4582ca59.
Report an issue: GitHub.