{"record":{"id":"98d1102c1d65887a","repo":"jesseduffield/lazygit","slug":"no-pull-request-found-for-this-branch-98d110","errorCode":null,"errorMessage":"No pull request found for this branch","messagePattern":"No pull request found for this branch","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/gui/controllers/local_commits_controller.go","lineNumber":679,"sourceCode":"\t}\n\n\treturn bindings\n}\n\nfunc (self *LocalCommitsController) checkedOutBranchHasPR() *types.DisabledReason {\n\tbranch := self.c.Model().CheckedOutBranch\n\tif _, ok := self.c.Model().PullRequestsMap[branch]; !ok {\n\t\treturn &types.DisabledReason{Text: self.c.Tr.NoPullRequestForBranch, ShowErrorInPanel: true}\n\t}\n\treturn nil\n}\n\nfunc (self *LocalCommitsController) openPRInBrowser() error {\n\tpr, ok := self.c.Model().PullRequestsMap[self.c.Model().CheckedOutBranch]\n\tif !ok {\n\t\t// Should be guarded against by the DisabledReason check, but be defensive in case\n\t\t// PullRequestsMap was updated concurrently by a background refresh\n\t\treturn errors.New(self.c.Tr.NoPullRequestForBranch)\n\t}\n\n\tself.c.LogAction(self.c.Tr.Actions.OpenPullRequest)\n\n\treturn self.c.OS().OpenLink(pr.Url)\n}\n\nfunc (self *LocalCommitsController) GetOnRenderToMain() func() {\n\treturn func() {\n\t\tself.c.Helpers().Diff.WithDiffModeCheck(func() {\n\t\t\tvar task types.UpdateTask\n\t\t\tcommit := self.context().GetSelected()\n\t\t\tif commit == nil {\n\t\t\t\ttask = types.NewRenderStringTask(self.c.Tr.NoCommitsThisBranch)\n\t\t\t} else if commit.Action == todo.UpdateRef {\n\t\t\t\ttask = types.NewRenderStringTask(\n\t\t\t\t\tutils.ResolvePlaceholderString(\n\t\t\t\t\t\tself.c.Tr.UpdateRefHere,","sourceCodeStart":661,"sourceCodeEnd":697,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/local_commits_controller.go#L661-L697","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"pr, ok := self.c.Model().PullRequestsMap[self.c.Model().CheckedOutBranch]\nif !ok {\n    // treat as no PR: disable action or prompt to create one\n    return nil\n}\n_ = pr","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["pull-request","integration","race-condition","github"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}