{"record":{"id":"53f1edf295dbd376","repo":"mislav/hub","slug":"invalid-pull-request-number-s","errorCode":null,"errorMessage":"invalid pull request number: '%s'","messagePattern":"invalid pull request number: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/pr.go","lineNumber":347,"sourceCode":"\tutils.Check(err)\n\n\tbaseProject, err := localRepo.MainProject()\n\tutils.Check(err)\n\n\thost, err := github.CurrentConfig().PromptForHost(baseProject.Host)\n\tutils.Check(err)\n\tgh := github.NewClientWithHost(host)\n\n\twords := args.Words()\n\topenURL := \"\"\n\tprNumber := 0\n\tvar pr *github.PullRequest\n\n\tif len(words) > 0 {\n\t\tif prNumber, err = strconv.Atoi(words[0]); err == nil {\n\t\t\topenURL = baseProject.WebURL(\"\", \"\", fmt.Sprintf(\"pull/%d\", prNumber))\n\t\t} else {\n\t\t\tutils.Check(fmt.Errorf(\"invalid pull request number: '%s'\", words[0]))\n\t\t}\n\t} else {\n\t\tpr, err = findCurrentPullRequest(localRepo, gh, baseProject, args.Flag.Value(\"--head\"))\n\t\tutils.Check(err)\n\t\topenURL = pr.HTMLURL\n\t}\n\n\targs.NoForward()\n\tif format := args.Flag.Value(\"--format\"); format != \"\" {\n\t\tif pr == nil {\n\t\t\tpr, err = gh.PullRequest(baseProject, strconv.Itoa(prNumber))\n\t\t\tutils.Check(err)\n\t\t}\n\t\tcolorize := colorizeOutput(args.Flag.HasReceived(\"--color\"), args.Flag.Value(\"--color\"))\n\t\tui.Println(formatPullRequest(*pr, format, colorize))\n\t\treturn\n\t}\n","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/pr.go#L329-L365","documentation":"`showPr` expects its first argument, when present, to be a pull request number. It parses the word with `strconv.Atoi`; on failure it raises this error instead of treating it as a URL or branch. Only bare numeric PR identifiers are accepted here.","triggerScenarios":"Running `gh pull-request show <arg>` where `<arg>` is non-numeric — e.g. a branch name, a partial URL, or a typo like \"12a\" — in `showPr`.","commonSituations":"Passing a branch name expecting branch resolution (not supported in this arg position); pasting a PR URL where a bare number is required; typos or copied text with whitespace/characters.","solutions":["Pass the bare numeric PR number: `gh pull-request show 123`.","If you meant to view by URL, strip to the number or use the URL form supported by the command.","Omit the argument entirely to auto-detect the current branch's PR (findCurrentPullRequest path)."],"exampleFix":"// before\ngh pull-request show feature/foo   // non-numeric\n// after\ngh pull-request show 123","handlingStrategy":"validation","validationCode":"arg := os.Args[len(os.Args)-1]\nif _, err := strconv.Atoi(arg); err != nil {\n    fmt.Fprintf(os.Stderr, \"%q is not a PR number; pass a bare numeric id or omit the arg to auto-detect\\n\", arg)\n    os.Exit(2)\n}","typeGuard":"func isPRNumber(s string) bool {\n    _, err := strconv.Atoi(s)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Pass bare numeric PR numbers, not branch names or URLs.","Omit the argument entirely to auto-detect the current branch's PR.","Sanitize copied values (strip whitespace/URL prefixes) before passing."],"tags":["pull-request","invalid-argument","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}