{"record":{"id":"8d9e6af0f0821fe6","repo":"mislav/hub","slug":"no-open-pull-requests-found-for-branch-s","errorCode":null,"errorMessage":"no open pull requests found for branch '%s'","messagePattern":"no open pull requests found for branch '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/pr.go","lineNumber":403,"sourceCode":"\t\tutils.Check(err)\n\t\tif headBranch, headProject, err := findPushTarget(currentBranch); err == nil {\n\t\t\theadWithOwner = fmt.Sprintf(\"%s:%s\", headProject.Owner, headBranch.ShortName())\n\t\t} else if headProject, err := deducePushTarget(currentBranch, gh.Host.User); err == nil {\n\t\t\theadWithOwner = fmt.Sprintf(\"%s:%s\", headProject.Owner, currentBranch.ShortName())\n\t\t} else {\n\t\t\theadWithOwner = fmt.Sprintf(\"%s:%s\", baseProject.Owner, currentBranch.ShortName())\n\t\t}\n\t}\n\n\tfilterParams[\"head\"] = headWithOwner\n\n\tpulls, err := gh.FetchPullRequests(baseProject, filterParams, 1, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if len(pulls) == 1 {\n\t\treturn &pulls[0], nil\n\t} else {\n\t\treturn nil, fmt.Errorf(\"no open pull requests found for branch '%s'\", headWithOwner)\n\t}\n}\n\nfunc branchTrackingInformation(branch *github.Branch) (string, *github.Branch, error) {\n\tbranchRemote, err := git.Config(fmt.Sprintf(\"branch.%s.remote\", branch.ShortName()))\n\tif branchRemote == \".\" {\n\t\terr = fmt.Errorf(\"branch is tracking another local branch\")\n\t}\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\tbranchMerge, err := git.Config(fmt.Sprintf(\"branch.%s.merge\", branch.ShortName()))\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\ttrackingBranch := &github.Branch{\n\t\tRepo: branch.Repo,\n\t\tName: branchMerge,","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/pr.go#L385-L421","documentation":"`findCurrentPullRequest` queries GitHub for open pull requests whose head matches the current branch (owner:branch). If the API succeeds but returns zero (or more than one, given the limit) matches, it concludes no open PR exists for the branch and returns this error. It is a lookup-miss, not an API failure.","triggerScenarios":"Running `gh pull-request show` with no argument (showPr -> findCurrentPullRequest) on a branch that has no open PR with head `owner:branch`, or where `FetchPullRequests` with the head filter returns an empty result set.","commonSituations":"Current branch is local-only (PR never opened or already merged/closed); branch pushed from a different fork so the owner:head filter doesn't match; PR exists but with a different head branch name than the local tracking branch.","solutions":["Open the PR first (`git pull-request` / `gh pull-request create`) for the current branch.","Verify the branch's tracking/remote configuration so the head filter resolves to the right owner:branch.","Check the PR still exists and is open — closed/merged PRs are filtered out.","View by explicit number instead: `gh pull-request show <number>`."],"exampleFix":"// before\ngit pull-request show   // current branch has no open PR\n// after\ngit pull-request            # create the PR first\n# or view explicitly:\ngit pull-request show 123","handlingStrategy":"try-catch","validationCode":"branch := currentBranch()\nremote, _ := git.Config(fmt.Sprintf(\"branch.%s.remote\", branch))\nif remote == \"\" {\n    fmt.Fprintln(os.Stderr, \"branch has no upstream; open a PR first\")\n    os.Exit(1)\n}","typeGuard":null,"tryCatchPattern":"pr, err := findCurrentPullRequest(localRepo, gh, baseProject, headFlag)\nif err != nil && strings.Contains(err.Error(), \"no open pull requests found\") {\n    // fallback: prompt for an explicit PR number\n    fmt.Fprintln(os.Stderr, \"open the PR first or pass a number: gh pull-request show <number>\")\n}","preventionTips":["Open a PR for the current branch before running `gh pull-request show` without args.","Ensure branch tracking (branch.<name>.remote) points at the fork that owns the PR head.","Remember closed/merged PRs are excluded — check state on the web UI.","Fall back to an explicit PR number when auto-detection is ambiguous."],"tags":["pull-request","not-found","branch"],"backgroundTag":"no-matching-pull-request","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}