{"record":{"id":"9bd7f8b5d478f8bd","repo":"anuraghazra/github-readme-stats","slug":"graphql-error-9bd7f8","errorCode":"GRAPHQL_ERROR","errorMessage":"Something went wrong while trying to retrieve the language data using the GraphQL API.","messagePattern":"Something went wrong while trying to retrieve the language data using the GraphQL API\\.","errorType":"error_code","errorClass":"CustomError","httpStatus":null,"severity":"error","filePath":"src/fetchers/top-languages.js","lineNumber":88,"sourceCode":"  }\n\n  const res = await retryer(fetcher, { login: username });\n\n  if (res.data.errors) {\n    logger.error(res.data.errors);\n    if (res.data.errors[0].type === \"NOT_FOUND\") {\n      throw new CustomError(\n        res.data.errors[0].message || \"Could not fetch user.\",\n        CustomError.USER_NOT_FOUND,\n      );\n    }\n    if (res.data.errors[0].message) {\n      throw new CustomError(\n        wrapTextMultiline(res.data.errors[0].message, 90, 1)[0],\n        res.statusText,\n      );\n    }\n    throw new CustomError(\n      \"Something went wrong while trying to retrieve the language data using the GraphQL API.\",\n      CustomError.GRAPHQL_ERROR,\n    );\n  }\n\n  let repoNodes = res.data.data.user.repositories.nodes;\n  /** @type {Record<string, boolean>} */\n  let repoToHide = {};\n  const allExcludedRepos = [...exclude_repo, ...excludeRepositories];\n\n  // populate repoToHide map for quick lookup\n  // while filtering out\n  if (allExcludedRepos) {\n    allExcludedRepos.forEach((repoName) => {\n      repoToHide[repoName] = true;\n    });\n  }\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/anuraghazra/github-readme-stats/blob/54a7985aeefda00d5eadb55b80c17c7f976c37d2/src/fetchers/top-languages.js#L70-L106","documentation":"The catch-all GraphQL failure: thrown when res.data.errors is present but the first error is neither type \"NOT_FOUND\" nor carries any message. It is the last-resort branch after the NOT_FOUND and message-bearing branches, indicating an unexpected/empty GraphQL error shape. The secondary message (src/common/error.js:17) is \"Please try again later\", signaling the library treats this as a transient upstream anomaly it cannot classify.","triggerScenarios":"res.data.errors exists and is an array, but errors[0].type !== \"NOT_FOUND\" AND errors[0].message is falsy/absent. This is an atypical GitHub response: e.g., an error object with only a path or locations field and no message, or an empty-message error returned during an upstream anomaly. The retryer has already consumed RATE_LIMITED cases, so this is not a rate-limit path.","commonSituations":"Rare GitHub API glitches that return malformed or message-less error objects; a future API contract change where errors carry a different shape; edge cases during GitHub deployments.","solutions":["Treat as transient: retry the request a few times with backoff before surfacing the error.","Inspect logger.error(res.data.errors) output to see the unclassified error shape and report it if it persists.","Check https://www.githubstatus.com for ongoing incidents.","If persistent, capture the full raw GraphQL response and file an issue, since this branch exists precisely because the error could not be categorized."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// No pre-call validation can prevent an unclassified upstream error.\n// At most, assert the environment is healthy before issuing the request.\nfunction assertEnv() {\n  if (!process.env.PAT_1) throw new Error(\"PAT_1 missing\");\n}\nassertEnv();","typeGuard":"function isGraphqlCatchAll(err) {\n  return err instanceof CustomError && err.type === CustomError.GRAPHQL_ERROR;\n}","tryCatchPattern":"async function fetchTopLangsResilient(username, attempts = 3) {\n  for (let i = 0; i < attempts; i++) {\n    try {\n      return await fetchTopLanguages(username);\n    } catch (err) {\n      if (err instanceof CustomError && err.type === CustomError.GRAPHQL_ERROR && i < attempts - 1) {\n        await new Promise((r) => setTimeout(r, 2 ** i * 500));\n        continue;\n      }\n      throw err;\n    }\n  }\n}","preventionTips":["Log the full res.data.errors object when this fires; the branch exists because the error is uncategorized.","Retry with backoff since the secondary message explicitly says 'try again later'.","If it persists, capture the raw GraphQL response and report it — it likely indicates a GitHub-side change."],"tags":["github-api","graphql","upstream","catch-all","retry"],"backgroundTag":null,"analyzedSha":"54a7985aeefda00d5eadb55b80c17c7f976c37d2","analyzedAt":"2026-08-12T23:20:41.776Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}