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

  1. Verify the branch actually has an open PR on the hosting service; create one if not.
  2. Wait for the pull-request refresh to complete (or trigger a refresh) and retry.
  3. Check git.logLevel / services config if PR fetching consistently fails (token, host config).
  4. 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

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


AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15). Data as JSON: /api/errors/98d1102c1d65887a. Report an issue: GitHub.