{"record":{"id":"534686ada21b81c5","repo":"badges/shields","slug":"gist-not-found","errorCode":null,"errorMessage":"gist not found","messagePattern":"gist not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/github/gist/github-gist-stars.service.js","lineNumber":94,"sourceCode":"        }\n      `,\n      variables: {\n        gistId,\n      },\n      schema,\n    })\n    return data\n  }\n\n  static transform({ data }) {\n    const {\n      data: {\n        viewer: { gist },\n      },\n    } = data\n\n    if (!gist) {\n      throw new NotFound({ prettyMessage: 'gist not found' })\n    }\n\n    const {\n      stargazerCount,\n      url,\n      name,\n      owner: { login },\n    } = gist\n\n    const stargazers = `https://gist.github.com/${login}/${name}/stargazers`\n\n    return { stargazerCount, url, stargazers }\n  }\n\n  async handle({ gistId }) {\n    const data = await this.fetch({ gistId })\n    const { stargazerCount, url, stargazers } =\n      await this.constructor.transform({","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/github/gist/github-gist-stars.service.js#L76-L112","documentation":"Thrown in GithubGistStarsService.transform when the GitHub GraphQL response contains no gist object under data.viewer.gist, meaning the authenticated viewer cannot see a gist with the given id. NotFound 'gist not found' is raised before reading stargazerCount.","triggerScenarios":"Requesting a gist stars badge with a gist id that does not exist, is secret (invisible to the token's viewer), or was deleted — the GraphQL query resolves gist to null.","commonSituations":"Gist was deleted or made secret after the badge was set up; gist id copied incorrectly (the badge uses the id, not the full URL with username); token's account differs from the gist owner for secret gists.","solutions":["Verify the gist exists and is public at gist.github.com","Use the correct gist id (the hex string in the gist URL) in the badge","If the gist is secret, make it public or ensure the configured token belongs to an account that can view it","Check the GitHub GraphQL API directly to confirm viewer.gist is non-null"],"exampleFix":"// before\n/github/gists/not-a-real-id/stars\n// after\n/github/gists/aa5a315d61ae9438b18d/stars","handlingStrategy":"type-guard","validationCode":"const res = await fetch(`https://api.github.com/gists/${gistId}`);if (res.status === 404) console.warn(`gist ${gistId} not visible or does not exist`);","typeGuard":"const gistExists = (data) => Boolean(data?.data?.viewer?.gist && typeof data.data.viewer.gist === 'object');","tryCatchPattern":"try { return await gistStarsBadge(gistId); } catch (e) { if (String(e.message).includes('gist not found')) { return renderBadge('gist unavailable'); } throw e; }","preventionTips":["Use the gist id (hex string), not the full gist URL, in badge requests","Confirm gists remain public; secret gists may be invisible to the badge server's token","Re-validate gist ids if badges break after gist deletion"],"tags":["github","not-found","gist"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}