{"record":{"id":"c23d24e1b73a0c75","repo":"jesseduffield/lazygit","slug":"a-remote-named-s-does-not-exist","errorCode":null,"errorMessage":"A remote named '%s' does not exist","messagePattern":"A remote named '(.+?)' does not exist","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gui/controllers/branches_controller.go","lineNumber":851,"sourceCode":"\t\t\t\t\t}\n\t\t\t\t\treturn self.createPullRequest(checkedOutBranch.UpstreamBranch, selectedBranch.UpstreamBranch)\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t\tmenuItems = append(menuItems, menuItemsForBranch(checkedOutBranch)...)\n\t}\n\n\tmenuItems = append(menuItems, menuItemsForBranch(selectedBranch)...)\n\n\treturn self.c.Menu(types.CreateMenuOptions{Title: fmt.Sprint(self.c.Tr.CreatePullRequestOptions), Items: menuItems})\n}\n\nfunc (self *BranchesController) promptForTargetBranchNameAndCreatePullRequest(fromBranch *models.Branch, toRemote string) error {\n\tremoteDoesNotExist := lo.NoneBy(self.c.Model().Remotes, func(remote *models.Remote) bool {\n\t\treturn remote.Name == toRemote\n\t})\n\tif remoteDoesNotExist {\n\t\treturn fmt.Errorf(self.c.Tr.NoValidRemoteName, toRemote)\n\t}\n\n\tself.c.Prompt(types.PromptOpts{\n\t\tTitle:               fmt.Sprintf(\"%s → %s/\", fromBranch.UpstreamBranch, toRemote),\n\t\tFindSuggestionsFunc: self.c.Helpers().Suggestions.GetRemoteBranchesForRemoteSuggestionsFunc(toRemote),\n\t\tHandleConfirm: func(toBranch string) error {\n\t\t\tself.c.Log.Debugf(\"PR will target branch '%s' on remote '%s'\", toBranch, toRemote)\n\t\t\treturn self.createPullRequest(fromBranch.UpstreamBranch, toBranch)\n\t\t},\n\t})\n\n\treturn nil\n}\n\nfunc (self *BranchesController) createPullRequest(from string, to string) error {\n\turl, err := self.c.Helpers().Host.GetPullRequestURL(from, to)\n\tif err != nil {\n\t\treturn err","sourceCodeStart":833,"sourceCodeEnd":869,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/branches_controller.go#L833-L869","documentation":"BranchesController.promptForTargetBranchNameAndCreatePullRequest (pkg/gui/controllers/branches_controller.go) looks up the requested remote in the already-loaded Model().Remotes via lo.NoneBy; when no remote with that name exists it surfaces the translated NoValidRemoteName string ('A remote named %s does not exist'). It is a pure precondition failure: the PR target remote must already be configured in the repo.","triggerScenarios":"Invoking the create-PR flow targeting a remote name that is not in git's remote list — e.g. choosing 'upstream' when only 'origin' is configured, or a remote deleted from .git/config while lazygit still shows a stale model.","commonSituations":"Fork workflows where the user selects the wrong remote in the PR-options menu; the remote was renamed or removed outside lazygit without a refresh; typos when a custom remote name is expected.","solutions":["Add the remote in a terminal: git remote add <name> <url>, then press 'R' / refresh in lazygit so Model().Remotes reloads.","Or pick the existing remote (usually origin) from the PR options menu.","If the remote was deleted intentionally, remove stale references and refresh before retrying."],"exampleFix":"# terminal\n# before: only 'origin' exists, PR targets 'upstream'\ngit remote add upstream https://github.com/org/repo.git\ngit fetch upstream\n# then refresh remotes in lazygit and retry","handlingStrategy":"validation","validationCode":"// Guard before creating the PR prompt:\nexists := false\nfor _, r := range remotes {\n\tif r.Name == toRemote {\n\t\texists = true\n\t}\n}\nif !exists {\n\treturn fmt.Errorf(\"remote %s missing; add it first\", toRemote)\n}","typeGuard":null,"tryCatchPattern":"if err := createPRToRemote(fromBranch, \"upstream\"); err != nil {\n\tif strings.Contains(err.Error(), \"does not exist\") {\n\t\t// run `git remote add` + fetch, then surface a retry affordance\n\t}\n\treturn err\n}","preventionTips":["Keep PR-target remotes (origin, upstream) configured before starting fork workflows.","Refresh remotes in lazygit after changing them on the command line."],"tags":["git","pull-request","remotes"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}