badges/shields · error · NotFound

user/org not found

Error message

user/org not found

What it means

The GitHub sponsors service uses a GraphQL query keyed on `repositoryOwner`. GraphQL does not 404 for unknown users; instead it returns `data: { repositoryOwner: null }`. The service detects this and throws `NotFound` with 'user/org not found' because sponsors data cannot exist without a valid owner.

Source

Thrown at services/github/github-sponsors.service.js:72

              }
            }
            ... on Organization {
              sponsorshipsAsMaintainer(includePrivate: true) {
                totalCount
              }
            }
          }
        }
      `,
      variables: { user },
      schema,
      transformErrors,
    })
  }

  transform({ data }) {
    if (data.repositoryOwner == null) {
      throw new NotFound({ prettyMessage: 'user/org not found' })
    }

    const count = data.repositoryOwner.sponsorshipsAsMaintainer.totalCount
    return { count }
  }

  async handle({ user }) {
    const json = await this.fetch({ user })
    const { count } = this.transform({ data: json.data })
    return this.constructor.render({
      count,
    })
  }
}

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Verify the user/org login in the badge URL exists on GitHub
  2. Check whether the account was renamed/deleted and update the badge URL
  3. Use the current login from the GitHub profile page

Example fix

// before
/badge/sponsors/nonexistent-user-xyz -> user/org not found
// after
/badge/sponsors/actual-user
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(`https://api.github.com/users/${login}`)
if (res.status === 404) throw new Error(`GitHub login '${login}' does not exist`)

Type guard

null

Try / catch

try {
  await fetchSponsorsBadge(login)
} catch (e) {
  if (e.message === 'user/org not found') return 'unknown'
  throw e
}

Prevention

When it happens

Trigger: Requesting a sponsors badge where the login in the URL matches no GitHub user or organization (GraphQL resolves repositoryOwner to null), while the HTTP request itself succeeds.

Common situations: Username typo in the badge URL; user renamed or deleted their account; org renamed; casing not the issue (GitHub is case-insensitive) but the login simply does not exist.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30). Data as JSON: /api/errors/cf29eb1613780c81. Report an issue: GitHub.