anuraghazra/github-readme-stats · error · Error

User Repository Not found

Error message

User Repository Not found

What it means

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.

Source

Thrown at src/fetchers/repo.js:93

  }
  if (!reponame) {
    throw new MissingParamError(["repo"], urlExample);
  }

  let res = await retryer(fetcher, { login: username, repo: reponame });

  const data = res.data.data;

  if (!data.user && !data.organization) {
    throw new Error("Not found");
  }

  const isUser = data.organization === null && data.user;
  const isOrg = data.user === null && data.organization;

  if (isUser) {
    if (!data.user.repository || data.user.repository.isPrivate) {
      throw new Error("User Repository Not found");
    }
    return {
      ...data.user.repository,
      starCount: data.user.repository.stargazers.totalCount,
    };
  }

  if (isOrg) {
    if (
      !data.organization.repository ||
      data.organization.repository.isPrivate
    ) {
      throw new Error("Organization Repository Not found");
    }
    return {
      ...data.organization.repository,
      starCount: data.organization.repository.stargazers.totalCount,
    };

View on GitHub (pinned to 54a7985aee)

Solutions

  1. Confirm the repo path at https://github.com/<username>/<repo>.
  2. If the repo is private, use a token with repo scope on PAT_1 — but note github-readme-stats is designed for public repos.
  3. Correct typos/renames in the repo param.

Example fix

// before
// GET /api/pin?username=anuraghazra&repo=github-readme-statz  (typo)

// after
// GET /api/pin?username=anuraghazra&repo=github-readme-stats
Defensive patterns

Strategy: try-catch

Validate before calling

// Optional: verify the repo is public before pinning.
async function repoIsPublic(owner, repo, token) {
  const r = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {
    headers: { Authorization: `token ${token}` },
  });
  if (!r.ok) return false;
  const j = await r.json();
  return j.private === false;
}

Try / catch

try {
  return await fetchRepo(username, repo);
} catch (err) {
  if (err.message === "User Repository Not found") return null;
  throw err;
}

Prevention

When it happens

Trigger: 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'.

Common situations: 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.

Related errors


AI-assisted analysis of anuraghazra/github-readme-stats@54a7985aee (2026-08-12). Data as JSON: /api/errors/c6a7358dc5c71f97. Report an issue: GitHub.