anuraghazra/github-readme-stats · error · Error
Not found
Error message
Not found
What it means
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.
Source
Thrown at src/fetchers/repo.js:85
* @returns {Promise<RepositoryData>} Repository data.
*/
const fetchRepo = async (username, reponame) => {
if (!username && !reponame) {
throw new MissingParamError(["username", "repo"], urlExample);
}
if (!username) {
throw new MissingParamError(["username"], urlExample);
}
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 ||View on GitHub (pinned to 54a7985aee)
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.
Example fix
// before // GET /api/pin?username=anurahazra&repo=github-readme-stats (typo) // after // GET /api/pin?username=anuraghazra&repo=github-readme-stats
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check that the owner exists (cheap REST call) before fetchRepo.
async function ownerExists(login, token) {
const r = await fetch(`https://api.github.com/users/${login}`, {
headers: { Authorization: `token ${token}` },
});
return r.ok;
} Try / catch
// Map 'Not found' to a caller-side 404.
try {
return await fetchRepo(username, repo);
} catch (err) {
if (err.message === "Not found") return null;
throw err;
} Prevention
- Confirm the owner at https://github.com/<username> before generating the URL.
- Strip whitespace and unusual characters from the username param.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Gist not found
- User Repository Not found
- Organization Repository Not found
- USER_NOT_FOUND
- ${res.data.errors[0].message}
AI-assisted analysis of anuraghazra/github-readme-stats@54a7985aee (2026-08-12).
Data as JSON: /api/errors/4a5807c6a9fffe28.
Report an issue: GitHub.