{"record":{"id":"c6a7358dc5c71f97","repo":"anuraghazra/github-readme-stats","slug":"user-repository-not-found","errorCode":null,"errorMessage":"User Repository Not found","messagePattern":"User Repository Not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/fetchers/repo.js","lineNumber":93,"sourceCode":"  }\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 ||\n      data.organization.repository.isPrivate\n    ) {\n      throw new Error(\"Organization Repository Not found\");\n    }\n    return {\n      ...data.organization.repository,\n      starCount: data.organization.repository.stargazers.totalCount,\n    };","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/anuraghazra/github-readme-stats/blob/54a7985aeefda00d5eadb55b80c17c7f976c37d2/src/fetchers/repo.js#L75-L111","documentation":"Generic Error thrown by fetchRepo in the isUser branch (data.organization === null && data.user truthy) when data.user.repository is null/undefined OR data.user.repository.isPrivate is true. The getRepo query's user(login:).repository(name:) returns null for a non-existent repo, and isPrivate flags a private repo — both are treated as 'not visible to this token' and rejected.","triggerScenarios":"The owner resolves as a user, but the repo name does not exist under that user, or the repo exists but is private. The token (PAT_1) lacks access to private repos, so isPrivate === true is treated equivalently to 'repository not found'.","commonSituations":"Repo was renamed, transferred (the new path differs), or made private after the URL was generated; a typo in the repo slug; or pinning a private repo with a public-scoped token.","solutions":["Confirm the repo path at https://github.com/<username>/<repo>.","If the repo is private, use a token with repo scope on PAT_1 — but note github-readme-stats is designed for public repos.","Correct typos/renames in the repo param."],"exampleFix":"// before\n// GET /api/pin?username=anuraghazra&repo=github-readme-statz  (typo)\n\n// after\n// GET /api/pin?username=anuraghazra&repo=github-readme-stats","handlingStrategy":"try-catch","validationCode":"// Optional: verify the repo is public before pinning.\nasync function repoIsPublic(owner, repo, token) {\n  const r = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {\n    headers: { Authorization: `token ${token}` },\n  });\n  if (!r.ok) return false;\n  const j = await r.json();\n  return j.private === false;\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await fetchRepo(username, repo);\n} catch (err) {\n  if (err.message === \"User Repository Not found\") return null;\n  throw err;\n}","preventionTips":["This project is designed for public repos; do not point it at private repos.","If a repo was renamed/transferred, update the URL to the new owner/path."],"tags":["repo-card","not-found","private-repo","github-api"],"backgroundTag":null,"analyzedSha":"54a7985aeefda00d5eadb55b80c17c7f976c37d2","analyzedAt":"2026-08-12T23:20:41.776Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}