{"record":{"id":"a3d9bc9c4497b084","repo":"mislav/hub","slug":"s-nare-you-sure-that-s-exists","errorCode":null,"errorMessage":"%s\\nAre you sure that %s exists?","messagePattern":"(.+?)\\\\nAre you sure that (.+?) exists\\?","errorType":"exception","errorClass":null,"httpStatus":404,"severity":"error","filePath":"github/client.go","lineNumber":138,"sourceCode":"\tres, err := api.GetFile(fmt.Sprintf(\"repos/%s/%s/pulls/%s\", project.Owner, project.Name, id), patchMediaType)\n\tif err = checkStatus(200, \"getting pull request patch\", res, err); err != nil {\n\t\treturn\n\t}\n\n\treturn res.Body, nil\n}\n\nfunc (client *Client) CreatePullRequest(project *Project, params map[string]interface{}) (pr *PullRequest, err error) {\n\tapi, err := client.simpleAPI()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tres, err := api.PostJSONPreview(fmt.Sprintf(\"repos/%s/%s/pulls\", project.Owner, project.Name), params, draftsType)\n\tif err = checkStatus(201, \"creating pull request\", res, err); err != nil {\n\t\tif res != nil && res.StatusCode == 404 {\n\t\t\tprojectURL := strings.SplitN(project.WebURL(\"\", \"\", \"\"), \"://\", 2)[1]\n\t\t\terr = fmt.Errorf(\"%s\\nAre you sure that %s exists?\", err, projectURL)\n\t\t}\n\t\treturn\n\t}\n\n\tpr = &PullRequest{}\n\terr = res.Unmarshal(pr)\n\n\treturn\n}\n\ntype PullRequestMergeResponse struct {\n\tSHA     string\n\tMerged  bool\n\tMessage string\n}\n\nfunc (client *Client) MergePullRequest(project *Project, prNumber int, params map[string]interface{}) (mr PullRequestMergeResponse, err error) {\n\tapi, err := client.simpleAPI()","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/github/client.go#L120-L156","documentation":"CreatePullRequest POSTs to `repos/<owner>/<repo>/pulls`. When the response status is 404, the original 'creating pull request' error is augmented with 'Are you sure that <projectURL> exists?' because GitHub returns 404 (not 403) for repositories the token cannot see or that don't exist. This is the library's hint that the repo slug is wrong or inaccessible.","triggerScenarios":"POST to repos/{owner}/{name}/pulls returns HTTP 404: the repository does not exist, the owner/name are misspelled, or the authenticated token has no access to a private repo (GitHub hides private repos as 404).","commonSituations":"Typo'd owner or repo name in the project config; opening a PR against a fork whose upstream slug was renamed/moved; token lacking access to an org's private repo; repo was deleted or transferred.","solutions":["Verify the repo slug exists: `gh repo view <owner>/<name>` or open projectURL in a browser while logged in.","Check token access: ensure your token has repo scope and you are a collaborator if the repo is private.","If the repo was moved, update the remote/project owner/name to the new slug.","Confirm you're pushing/PRing against the right host (enterprise vs github.com) so the API base URL matches."],"exampleFix":"// before\nclient.CreatePullRequest(project, params) // 404: repo inaccessible\n// after\n// verify first\nif _, _, err := api.Repositories.Get(ctx, project.Owner, project.Name); err != nil {\n    return fmt.Errorf(\"repo %s/%s not found or inaccessible: %w\", project.Owner, project.Name, err)\n}\nreturn client.CreatePullRequest(project, params)","handlingStrategy":"validation","validationCode":"resp, err := http.Get(\"https://api.github.com/repos/\" + owner + \"/\" + name)\nif err != nil || resp.StatusCode == 404 {\n    return fmt.Errorf(\"repo %s/%s does not exist or token lacks access\", owner, name)\n}","typeGuard":null,"tryCatchPattern":"pr, err := client.CreatePullRequest(project, params)\nif err != nil && strings.Contains(err.Error(), \"Are you sure that\") {\n    return fmt.Errorf(\"check %s: repo missing, renamed, or token lacks access\", project.WebURL(\"\",\"\",\"\"))\n}","preventionTips":["Verify the owner/repo slug exists before creating PRs (GET /repos/{owner}/{repo}).","Ensure the token has repo scope and access to private repos.","After repo renames/transfers, update remotes and project config.","Use `gh repo view <owner>/<name>` as a preflight check."],"tags":["github-api","http-404","pull-request"],"backgroundTag":"github-api-404-repository-not-found","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}