anuraghazra/github-readme-stats · error · Error

Organization Repository Not found

Error message

Organization Repository Not found

What it means

Generic Error thrown by fetchRepo in the isOrg branch (data.user === null && data.organization truthy) when data.organization.repository is null/undefined OR isPrivate is true. Mirrors the user-repo check but for organization-owned repositories — the org exists, but the repo is missing or private.

Source

Thrown at src/fetchers/repo.js:106

  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,
    };
  }

  throw new Error("Unexpected behavior");
};

export { fetchRepo };
export default fetchRepo;

View on GitHub (pinned to 54a7985aee)

Solutions

  1. Verify the org + repo path at https://github.com/<org>/<repo>.
  2. Fix typos/renames in the repo param.
  3. If the repo is private, supply a PAT_1 with repo scope (project is intended for public repos).

Example fix

// before
// GET /api/pin?username=microsoft&repo=vscodee  (typo)

// after
// GET /api/pin?username=microsoft&repo=vscode
Defensive patterns

Strategy: try-catch

Validate before calling

async function orgRepoIsPublic(org, repo, token) {
  const r = await fetch(`https://api.github.com/repos/${org}/${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 === "Organization Repository Not found") return null;
  throw err;
}

Prevention

When it happens

Trigger: The login resolves as an organization, but the repo does not exist under that org, or it exists and is private. Same isPrivate semantics as the user branch: a private repo with a public-scoped token is indistinguishable from a missing one.

Common situations: Org repo was renamed, transferred out, or set to private; typo in the repo name; or attempting to pin an internal/private org repo without an authorized token.

Related errors


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