{"record":{"id":"2be8af0c12620d69","repo":"anuraghazra/github-readme-stats","slug":"gist-not-found","errorCode":null,"errorMessage":"Gist not found","messagePattern":"Gist not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/fetchers/gist.js","lineNumber":98,"sourceCode":" * @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,\n  };\n};\n\nexport { fetchGist };\nexport default fetchGist;\n","sourceCodeStart":80,"sourceCodeEnd":115,"githubUrl":"https://github.com/anuraghazra/github-readme-stats/blob/54a7985aeefda00d5eadb55b80c17c7f976c37d2/src/fetchers/gist.js#L80-L115","documentation":"Thrown by fetchGist when the GraphQL call succeeded with no errors array but res.data.data.viewer.gist is null/undefined. In the gist query, viewer.gist(name:) returns null when no gist with that name is visible to the token, so a non-existent or inaccessible ID lands here rather than in the errors branch.","triggerScenarios":"The gist ID resolves to no gist from the token's point of view: the gist was deleted; the ID is a valid-format hash that never existed; or the gist is secret and owned by a different account (GitHub returns null rather than an error for non-visible secret gists).","commonSituations":"A bookmarked/cached URL pointing at a since-deleted gist; a typo in the ID that still looks like a hash; or attempting to read another user's secret gist.","solutions":["Open https://gist.github.com/<your-user>/<id> in a browser to confirm the gist still exists and is public.","If it was deleted, regenerate it and update the URL with the new ID.","If it is secret, make it public or switch to a PAT owned by the gist author."],"exampleFix":"// before\n// GET /api/gist?id=<deleted_gist_id>  -> 'Gist not found'\n\n// after\n// GET /api/gist?id=<current_public_gist_id>","handlingStrategy":"try-catch","validationCode":"// Optional pre-check that the gist is reachable from the configured token.\nasync function gistExists(id, token) {\n  const r = await fetch(`https://api.github.com/gists/${id}`, {\n    headers: { Authorization: `token ${token}` },\n  });\n  return r.ok;\n}","typeGuard":null,"tryCatchPattern":"// Treat 'Gist not found' as a 404-equivalent.\ntry {\n  return await fetchGist(id);\n} catch (err) {\n  if (err.message === \"Gist not found\") return null; // caller renders a 404\n  throw err;\n}","preventionTips":["Open the gist URL in a browser as a quick liveness check before pinning.","Remember a secret gist you don't own returns null (this error), not a permissions error."],"tags":["gist","not-found","github-api","graphql"],"backgroundTag":null,"analyzedSha":"54a7985aeefda00d5eadb55b80c17c7f976c37d2","analyzedAt":"2026-08-12T23:20:41.776Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}