anuraghazra/github-readme-stats · error · MissingParamError
Missing params "repo" make sure you pass the parameters in U
Error message
Missing params "repo" make sure you pass the parameters in URL
What it means
MissingParamError thrown by fetchRepo when username is present but reponame is falsy. Reached only after the first two guards pass (so username is truthy and the combined check was false). The constructor reports only "repo" as missing with urlExample as the secondary message.
Source
Thrown at src/fetchers/repo.js:77
* @typedef {import("./types").RepositoryData} RepositoryData Repository data.
*/
/**
* Fetch repository data.
*
* @param {string} username GitHub username.
* @param {string} reponame GitHub repository name.
* @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 {View on GitHub (pinned to 54a7985aee)
Solutions
- Add the repo: /api/pin?username=<owner>&repo=<name>.
- Validate that repo is a non-empty string before requesting.
Example fix
// before // GET /api/pin?username=anuraghazra // after // GET /api/pin?username=anuraghazra&repo=github-readme-stats
Defensive patterns
Strategy: validation
Validate before calling
function requireRepo(repo) {
if (!repo || typeof repo !== "string") {
throw new Error("repo is required: /api/pin?username=OWNER&repo=NAME");
}
} Type guard
const isNonEmptyString = (v) => typeof v === "string" && v.trim().length > 0;
Prevention
- Validate the repo slug is non-empty at the handler boundary.
- Reject repo names containing slashes (they denote owner/repo, not a bare repo).
When it happens
Trigger: A request like /api/pin?username=anuraghazra with no repo. Both earlier guards pass (username is truthy, and the combined !username && !reponame check is false because username exists), so control reaches the reponame-only check at line 76.
Common situations: A URL template that interpolates the owner but omits the repo segment; a truncated copy-paste; or a generator that resolved the owner but not the repo slug.
Related errors
- Missing params "username", "repo" make sure you pass the par
- Missing params "username" make sure you pass the parameters
- Missing params "id" make sure you pass the parameters in URL
- Missing params "username" make sure you pass the parameters
- Could not render stats card.
AI-assisted analysis of anuraghazra/github-readme-stats@54a7985aee (2026-08-12).
Data as JSON: /api/errors/d08bac622b530571.
Report an issue: GitHub.