{"record":{"id":"4a5807c6a9fffe28","repo":"anuraghazra/github-readme-stats","slug":"not-found","errorCode":null,"errorMessage":"Not found","messagePattern":"Not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/fetchers/repo.js","lineNumber":85,"sourceCode":" * @returns {Promise<RepositoryData>} Repository data.\n */\nconst fetchRepo = async (username, reponame) => {\n  if (!username && !reponame) {\n    throw new MissingParamError([\"username\", \"repo\"], urlExample);\n  }\n  if (!username) {\n    throw new MissingParamError([\"username\"], urlExample);\n  }\n  if (!reponame) {\n    throw new MissingParamError([\"repo\"], urlExample);\n  }\n\n  let res = await retryer(fetcher, { login: username, repo: reponame });\n\n  const data = res.data.data;\n\n  if (!data.user && !data.organization) {\n    throw new Error(\"Not found\");\n  }\n\n  const isUser = data.organization === null && data.user;\n  const isOrg = data.user === null && data.organization;\n\n  if (isUser) {\n    if (!data.user.repository || data.user.repository.isPrivate) {\n      throw new Error(\"User Repository Not found\");\n    }\n    return {\n      ...data.user.repository,\n      starCount: data.user.repository.stargazers.totalCount,\n    };\n  }\n\n  if (isOrg) {\n    if (\n      !data.organization.repository ||","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/anuraghazra/github-readme-stats/blob/54a7985aeefda00d5eadb55b80c17c7f976c37d2/src/fetchers/repo.js#L67-L103","documentation":"Generic Error thrown by fetchRepo after the GraphQL response resolves but both data.user and data.organization are null. The getRepo query asks for user(login:) and organization(login:) in parallel; GitHub returns null for whichever side doesn't match, so both null means the login is neither a user nor an organization. This is a plain Error (not CustomError), so it carries no type or secondary message.","triggerScenarios":"Calling fetchRepo with a login that is not a GitHub user or organization — a typo, a renamed/transferred account that 404s, or a non-existent handle. The retryer returns a valid response with data.user === null && data.organization === null.","commonSituations":"Misspelled username; a user who deleted their account; trailing whitespace or special characters in the username; or confusion between a repo name and an owner name.","solutions":["Open https://github.com/<username> in a browser to confirm the owner exists.","Strip whitespace and verify the spelling of the username param.","If the account was renamed, use the new login."],"exampleFix":"// before\n// GET /api/pin?username=anurahazra&repo=github-readme-stats  (typo)\n\n// after\n// GET /api/pin?username=anuraghazra&repo=github-readme-stats","handlingStrategy":"try-catch","validationCode":"// Pre-check that the owner exists (cheap REST call) before fetchRepo.\nasync function ownerExists(login, token) {\n  const r = await fetch(`https://api.github.com/users/${login}`, {\n    headers: { Authorization: `token ${token}` },\n  });\n  return r.ok;\n}","typeGuard":null,"tryCatchPattern":"// Map 'Not found' to a caller-side 404.\ntry {\n  return await fetchRepo(username, repo);\n} catch (err) {\n  if (err.message === \"Not found\") return null;\n  throw err;\n}","preventionTips":["Confirm the owner at https://github.com/<username> before generating the URL.","Strip whitespace and unusual characters from the username param."],"tags":["repo-card","not-found","github-api","graphql"],"backgroundTag":null,"analyzedSha":"54a7985aeefda00d5eadb55b80c17c7f976c37d2","analyzedAt":"2026-08-12T23:20:41.776Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}