{"record":{"id":"55e5724ecd3992d6","repo":"anuraghazra/github-readme-stats","slug":"missing-params-id-make-sure-you-pass-the-paramet","errorCode":null,"errorMessage":"Missing params \"id\" make sure you pass the parameters in URL","messagePattern":"Missing params \"id\" make sure you pass the parameters in URL","errorType":"validation","errorClass":"MissingParamError","httpStatus":null,"severity":"error","filePath":"src/fetchers/gist.js","lineNumber":91,"sourceCode":"    }\n  }\n\n  return primaryLanguage;\n};\n\n/**\n * @typedef {import('./types').GistData} GistData Gist data.\n */\n\n/**\n * Fetch GitHub gist information by given username and ID.\n *\n * @param {string} id GitHub gist ID.\n * @returns {Promise<GistData>} Gist data.\n */\nconst fetchGist = async (id) => {\n  if (!id) {\n    throw new MissingParamError([\"id\"], \"/api/gist?id=GIST_ID\");\n  }\n  const res = await retryer(fetcher, { gistName: id });\n  if (res.data.errors) {\n    throw new Error(res.data.errors[0].message);\n  }\n  if (!res.data.data.viewer.gist) {\n    throw new Error(\"Gist not found\");\n  }\n  const data = res.data.data.viewer.gist;\n  return {\n    name: data.files[Object.keys(data.files)[0]].name,\n    nameWithOwner: `${data.owner.login}/${\n      data.files[Object.keys(data.files)[0]].name\n    }`,\n    description: data.description,\n    language: calculatePrimaryLanguage(data.files),\n    starsCount: data.stargazerCount,\n    forksCount: data.forks.totalCount,","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/anuraghazra/github-readme-stats/blob/54a7985aeefda00d5eadb55b80c17c7f976c37d2/src/fetchers/gist.js#L73-L109","documentation":"MissingParamError thrown by fetchGist when the 'id' argument is falsy before any network call. The constructor builds the message 'Missing params \"id\" make sure you pass the parameters in URL' and attaches a secondaryMessage of '/api/gist?id=GIST_ID' so the rendered error card shows a correct example URL.","triggerScenarios":"A request to /api/gist with no id query parameter (or id empty), e.g. GET /api/gist or GET /api/gist?id=. The api/gist.js handler passes req.query.gist_id (or equivalent) straight into fetchGist, which fails the !id guard.","commonSituations":"User copies the gist URL pattern but forgets to substitute the actual gist ID; a templating layer strips the id param; or the wrong query key is used (e.g. ?gist= instead of ?id=).","solutions":["Append a real gist ID: /api/gist?id=<gist_id> where <gist_id> is the hash from the gist URL.","If building the URL programmatically, guard that id is a non-empty string before issuing the request.","Double-check the param name is 'id' (not 'gist', 'gist_id', or 'name')."],"exampleFix":"// before\n// GET /api/gist\n\n// after\n// GET /api/gist?id=aa5a315d61ae9438b18d","handlingStrategy":"validation","validationCode":"// Validate the gist id is a non-empty hex-ish string before calling fetchGist.\nfunction requireGistId(id) {\n  if (!id || typeof id !== \"string\" || !/^[0-9a-f]+$/i.test(id)) {\n    throw new Error(\"Missing or malformed gist id; expected /api/gist?id=<hex>\");\n  }\n}","typeGuard":"// Narrow an unknown query value to a usable gist id.\nfunction isGistId(v) {\n  return typeof v === \"string\" && /^[0-9a-f]+$/i.test(v);\n}","tryCatchPattern":null,"preventionTips":["Validate the id query param at the API handler boundary before delegating to fetchGist.","Use the MissingParamError secondary message (/api/gist?id=GIST_ID) as the canonical example in your docs."],"tags":["gist","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"}