{"record":{"id":"d25d0a55d5740508","repo":"cli/cli","slug":"resolving-parent-reference-q-w","errorCode":null,"errorMessage":"resolving --parent reference %q: %w","messagePattern":"resolving --parent reference %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/issue/create/create.go","lineNumber":461,"sourceCode":"\t\tHostname: baseRepo.RepoHost(),\n\t}\n\n\tif opts.IssueType != \"\" {\n\t\ttypeID := opts.issueTypeID\n\t\tif typeID == \"\" {\n\t\t\tvar err error\n\t\t\ttypeID, err = issueShared.ResolveIssueTypeName(client, baseRepo, opts.IssueType)\n\t\t\tif err != nil {\n\t\t\t\treturn api.DeferredUpdateIssueOptions{}, err\n\t\t\t}\n\t\t}\n\t\tupdateOpts.IssueTypeID = typeID\n\t}\n\n\tif opts.Parent != \"\" {\n\t\tparentID, err := issueShared.ResolveIssueRef(client, baseRepo, opts.Parent)\n\t\tif err != nil {\n\t\t\treturn api.DeferredUpdateIssueOptions{}, fmt.Errorf(\"resolving --parent reference %q: %w\", opts.Parent, err)\n\t\t}\n\t\tupdateOpts.ParentID = parentID\n\t}\n\n\tfor _, ref := range opts.BlockedBy {\n\t\tid, err := issueShared.ResolveIssueRef(client, baseRepo, ref)\n\t\tif err != nil {\n\t\t\treturn api.DeferredUpdateIssueOptions{}, fmt.Errorf(\"resolving --blocked-by reference %q: %w\", ref, err)\n\t\t}\n\t\tupdateOpts.AddBlockedByIDs = append(updateOpts.AddBlockedByIDs, id)\n\t}\n\n\tfor _, ref := range opts.Blocking {\n\t\tid, err := issueShared.ResolveIssueRef(client, baseRepo, ref)\n\t\tif err != nil {\n\t\t\treturn api.DeferredUpdateIssueOptions{}, fmt.Errorf(\"resolving --blocking reference %q: %w\", ref, err)\n\t\t}\n\t\tupdateOpts.AddBlockingIDs = append(updateOpts.AddBlockingIDs, id)","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/cli/cli/blob/0eeec0b92edbe70199f9768522f831d3534f41ad/pkg/cmd/issue/create/create.go#L443-L479","documentation":"Thrown by gh issue create when issueShared.ResolveIssueRef cannot turn the --parent argument into an issue node ID before the create mutation. The %w keeps the underlying cause: not-found issue, PR passed where an issue is required, no permission, or an unparseable reference.","triggerScenarios":"`gh issue create --parent 999` where #999 does not exist in the base repo, is a pull request, is in a different repo when the reference lacks OWNER/REPO#n form, or the token lacks read access to it.","commonSituations":"Referencing an issue number from a fork or upstream repo without the full OWNER/REPO#n syntax, using a number that was transferred/deleted, or branch skew between local knowledge and the actual repo state.","solutions":["Verify the target resolves: `gh issue view OWNER/REPO#999`.","Use the fully-qualified form OWNER/REPO#n for cross-repository parents.","Confirm the referenced item is an issue, not a PR (`gh pr view` will tell you which it is).","Check `gh auth status` for a token with read scope on that repo."],"exampleFix":"# before\ngh issue create --title \"sub\" --parent 999\n# gh: resolving --parent reference \"999\": ...\n\n# after\ngh issue view upstream/repo#999   # confirm it exists and is an issue\ngh issue create --title \"sub\" --parent upstream/repo#999","handlingStrategy":"validation","validationCode":"// Resolve parent refs up front and drop bad ones:\nfunc validIssueRef(client *api.Client, base ghrepo.Interface, ref string) bool {\n\t_, err := issueShared.ResolveIssueRef(client, base, ref)\n\treturn err == nil\n}\n// for each --parent value, skip or fail fast with the offending ref named","typeGuard":"func isRefResolutionErr(err error) bool {\n\treturn err != nil && strings.HasPrefix(err.Error(), \"resolving --parent reference\")\n}","tryCatchPattern":"if err := createRun(opts); err != nil {\n\tif strings.Contains(err.Error(), \"resolving --parent reference\") {\n\t\tcause := errors.Unwrap(err)\n\t\t_ = cause // not-found vs permission drives the fix; verify with `gh issue view` and retry\n\t}\n}","preventionTips":["Use fully-qualified OWNER/REPO#n refs for anything cross-repo.","Pre-verify refs with `gh issue view` in scripts before create.","Ensure refs point at issues, not PRs."],"tags":["issue","references","parent","validation"],"backgroundTag":null,"analyzedSha":"0eeec0b92edbe70199f9768522f831d3534f41ad","analyzedAt":"2026-08-15T12:31:05.478Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}