{"record":{"id":"d08bac622b530571","repo":"anuraghazra/github-readme-stats","slug":"missing-params-repo-make-sure-you-pass-the-param","errorCode":null,"errorMessage":"Missing params \"repo\" make sure you pass the parameters in URL","messagePattern":"Missing params \"repo\" make sure you pass the parameters in URL","errorType":"validation","errorClass":"MissingParamError","httpStatus":null,"severity":"error","filePath":"src/fetchers/repo.js","lineNumber":77,"sourceCode":" * @typedef {import(\"./types\").RepositoryData} RepositoryData Repository data.\n */\n\n/**\n * Fetch repository data.\n *\n * @param {string} username GitHub username.\n * @param {string} reponame GitHub repository name.\n * @returns {Promise<RepositoryData>} Repository data.\n */\nconst fetchRepo = async (username, reponame) => {\n  if (!username && !reponame) {\n    throw new MissingParamError([\"username\", \"repo\"], urlExample);\n  }\n  if (!username) {\n    throw new MissingParamError([\"username\"], urlExample);\n  }\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 {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/anuraghazra/github-readme-stats/blob/54a7985aeefda00d5eadb55b80c17c7f976c37d2/src/fetchers/repo.js#L59-L95","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add the repo: /api/pin?username=<owner>&repo=<name>.","Validate that repo is a non-empty string before requesting."],"exampleFix":"// before\n// GET /api/pin?username=anuraghazra\n\n// after\n// GET /api/pin?username=anuraghazra&repo=github-readme-stats","handlingStrategy":"validation","validationCode":"function requireRepo(repo) {\n  if (!repo || typeof repo !== \"string\") {\n    throw new Error(\"repo is required: /api/pin?username=OWNER&repo=NAME\");\n  }\n}","typeGuard":"const isNonEmptyString = (v) => typeof v === \"string\" && v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Validate the repo slug is non-empty at the handler boundary.","Reject repo names containing slashes (they denote owner/repo, not a bare repo)."],"tags":["repo-card","missing-param","validation","query-params"],"backgroundTag":null,"analyzedSha":"54a7985aeefda00d5eadb55b80c17c7f976c37d2","analyzedAt":"2026-08-12T23:20:41.776Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}