cli/cli · error

resolving --parent reference %q: %w

Error message

resolving --parent reference %q: %w

What it means

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.

Source

Thrown at pkg/cmd/issue/create/create.go:461

		Hostname: baseRepo.RepoHost(),
	}

	if opts.IssueType != "" {
		typeID := opts.issueTypeID
		if typeID == "" {
			var err error
			typeID, err = issueShared.ResolveIssueTypeName(client, baseRepo, opts.IssueType)
			if err != nil {
				return api.DeferredUpdateIssueOptions{}, err
			}
		}
		updateOpts.IssueTypeID = typeID
	}

	if opts.Parent != "" {
		parentID, err := issueShared.ResolveIssueRef(client, baseRepo, opts.Parent)
		if err != nil {
			return api.DeferredUpdateIssueOptions{}, fmt.Errorf("resolving --parent reference %q: %w", opts.Parent, err)
		}
		updateOpts.ParentID = parentID
	}

	for _, ref := range opts.BlockedBy {
		id, err := issueShared.ResolveIssueRef(client, baseRepo, ref)
		if err != nil {
			return api.DeferredUpdateIssueOptions{}, fmt.Errorf("resolving --blocked-by reference %q: %w", ref, err)
		}
		updateOpts.AddBlockedByIDs = append(updateOpts.AddBlockedByIDs, id)
	}

	for _, ref := range opts.Blocking {
		id, err := issueShared.ResolveIssueRef(client, baseRepo, ref)
		if err != nil {
			return api.DeferredUpdateIssueOptions{}, fmt.Errorf("resolving --blocking reference %q: %w", ref, err)
		}
		updateOpts.AddBlockingIDs = append(updateOpts.AddBlockingIDs, id)

View on GitHub (pinned to 0eeec0b92e)

Solutions

  1. Verify the target resolves: `gh issue view OWNER/REPO#999`.
  2. Use the fully-qualified form OWNER/REPO#n for cross-repository parents.
  3. Confirm the referenced item is an issue, not a PR (`gh pr view` will tell you which it is).
  4. Check `gh auth status` for a token with read scope on that repo.

Example fix

# before
gh issue create --title "sub" --parent 999
# gh: resolving --parent reference "999": ...

# after
gh issue view upstream/repo#999   # confirm it exists and is an issue
gh issue create --title "sub" --parent upstream/repo#999
Defensive patterns

Strategy: validation

Validate before calling

// Resolve parent refs up front and drop bad ones:
func validIssueRef(client *api.Client, base ghrepo.Interface, ref string) bool {
	_, err := issueShared.ResolveIssueRef(client, base, ref)
	return err == nil
}
// for each --parent value, skip or fail fast with the offending ref named

Type guard

func isRefResolutionErr(err error) bool {
	return err != nil && strings.HasPrefix(err.Error(), "resolving --parent reference")
}

Try / catch

if err := createRun(opts); err != nil {
	if strings.Contains(err.Error(), "resolving --parent reference") {
		cause := errors.Unwrap(err)
		_ = cause // not-found vs permission drives the fix; verify with `gh issue view` and retry
	}
}

Prevention

When it happens

Trigger: `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.

Common situations: 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.

Related errors


AI-assisted analysis of cli/cli@0eeec0b92e (2026-08-15). Data as JSON: /api/errors/d25d0a55d5740508. Report an issue: GitHub.