{"record":{"id":"cf29eb1613780c81","repo":"badges/shields","slug":"user-org-not-found","errorCode":null,"errorMessage":"user/org not found","messagePattern":"user/org not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/github/github-sponsors.service.js","lineNumber":72,"sourceCode":"              }\n            }\n            ... on Organization {\n              sponsorshipsAsMaintainer(includePrivate: true) {\n                totalCount\n              }\n            }\n          }\n        }\n      `,\n      variables: { user },\n      schema,\n      transformErrors,\n    })\n  }\n\n  transform({ data }) {\n    if (data.repositoryOwner == null) {\n      throw new NotFound({ prettyMessage: 'user/org not found' })\n    }\n\n    const count = data.repositoryOwner.sponsorshipsAsMaintainer.totalCount\n    return { count }\n  }\n\n  async handle({ user }) {\n    const json = await this.fetch({ user })\n    const { count } = this.transform({ data: json.data })\n    return this.constructor.render({\n      count,\n    })\n  }\n}\n","sourceCodeStart":54,"sourceCodeEnd":87,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/github/github-sponsors.service.js#L54-L87","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the user/org login in the badge URL exists on GitHub","Check whether the account was renamed/deleted and update the badge URL","Use the current login from the GitHub profile page"],"exampleFix":"// before\n/badge/sponsors/nonexistent-user-xyz -> user/org not found\n// after\n/badge/sponsors/actual-user","handlingStrategy":"validation","validationCode":"const res = await fetch(`https://api.github.com/users/${login}`)\nif (res.status === 404) throw new Error(`GitHub login '${login}' does not exist`)","typeGuard":"null","tryCatchPattern":"try {\n  await fetchSponsorsBadge(login)\n} catch (e) {\n  if (e.message === 'user/org not found') return 'unknown'\n  throw e\n}","preventionTips":["Copy the login exactly from the GitHub profile URL","Re-check badge URLs after account or org renames","Remove badges for deleted accounts"],"tags":["github","not-found","graphql","user"],"backgroundTag":"entity-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}