cli/cli · error
resource not found, please check the URL
Error message
resource not found, please check the URL
What it means
Returned by GetIssueOrPullRequest after a successful GraphQL query of a URL's resource node when the __typename is neither "Issue" nor "PullRequest". The command can only add issues and pull requests to projects, so any other resource type (discussion, discussion comment, or a null/empty typename from a bad URL) produces this error.
Source
Thrown at pkg/cmd/project/shared/queries/queries.go:1322
func (c *Client) IssueOrPullRequestID(rawURL string) (string, error) {
uri, err := url.Parse(rawURL)
if err != nil {
return "", err
}
variables := map[string]interface{}{
"url": githubv4.URI{URL: uri},
}
var query issueOrPullRequest
err = c.doQueryWithProgressIndicator("GetIssueOrPullRequest", &query, variables)
if err != nil {
return "", err
}
if query.Resource.Typename == "Issue" {
return query.Resource.Issue.ID, nil
} else if query.Resource.Typename == "PullRequest" {
return query.Resource.PullRequest.ID, nil
}
return "", errors.New("resource not found, please check the URL")
}
// userProjects queries the $first projects of a user.
type userProjects struct {
Owner struct {
Projects struct {
TotalCount int
PageInfo PageInfo
Nodes []projectQueryWithoutQueryableItems
} `graphql:"projectsV2(first: $first, after: $after)"`
Login string
} `graphql:"user(login: $login)"`
}
// orgProjects queries the $first projects of an organization.
type orgProjects struct {
Owner struct {
Projects struct {View on GitHub (pinned to 0eeec0b92e)
Solutions
- Check the URL points to an issue or pull request: https://github.com/OWNER/REPO/issues/N or .../pull/N
- If you meant a discussion, note discussions are not supported by this code path; use the GraphQL API directly if you must add them
- Print the typename in a debug run (GH_DEBUG=1) to see what the URL actually resolved to
- Upgrade gh in case newer versions support more resource types
Example fix
// before gh project item-add 123 --url https://github.com/org/repo/discussions/45 // after gh project item-add 123 --url https://github.com/org/repo/issues/45
Defensive patterns
Strategy: validation
Validate before calling
// Accept only issue/PR URLs before calling the API:
re := regexp.MustCompile(`^https://[^/]+/([^/]+)/([^/]+)/(issues|pull)/\d+$`)
if !re.MatchString(rawURL) {
return fmt.Errorf("%q is not an issue or pull request URL", rawURL)
} Try / catch
id, err := queries.GetIssueOrPullRequest(client, uri)
if err != nil && strings.Contains(err.Error(), "resource not found") {
return fmt.Errorf("%s: only issue and pull request URLs can be added; check the URL", uri) Prevention
- Validate the URL shape (issues/N or pull/N) in scripts before invoking gh project item-add
- Never paste discussion or repository URLs where an issue URL is expected
- Construct URLs from owner/repo/number in automation rather than scraping them from pages
When it happens
Trigger: Passing a URL to a project item-add command that resolves to something other than an Issue or PullRequest, e.g. a discussion URL (https://github.com/o/r/discussions/123), a repository URL, or a malformed URL that makes the GraphQL node resolve to an unexpected typename. The query itself succeeds, so only the typename dispatch fails.
Common situations: Users copy a discussions link instead of an issue link when running `gh project item-add`; passing a URL with a trailing slash or fragment that changes resolution; new GitHub resource types that the older gh version does not map.
Related errors
- resource not found, please check the URL: %s
- unable to determine an appropriate value for the 'branch' pl
- unknown owner type
- no projects found for %s
- error: your authentication token is missing required scopes
AI-assisted analysis of cli/cli@0eeec0b92e (2026-08-15).
Data as JSON: /api/errors/01f3d26527d839f7.
Report an issue: GitHub.