{"record":{"id":"bf71f635030cce90","repo":"affaan-m/ECC","slug":"github-graphql-returned-errors","errorCode":null,"errorMessage":"GitHub GraphQL returned errors","messagePattern":"GitHub GraphQL returned errors","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/discord/release-announce.mjs","lineNumber":37,"sourceCode":"async function request(url, options = {}, attempts = 3) {\n  for (let attempt = 1; attempt <= attempts; attempt += 1) {\n    const response = await fetch(url, options);\n    if (response.status !== 429 || attempt === attempts) return response;\n    const data = await response.json().catch(() => ({}));\n    await sleep(Math.min(Number(data.retry_after || 1) * 1000 + 250, 10_000));\n  }\n  throw new Error('request retry budget exhausted');\n}\n\nasync function githubGraphql(query, variables) {\n  const response = await request('https://api.github.com/graphql', {\n    method: 'POST',\n    headers: { Authorization: `Bearer ${env.GITHUB_TOKEN}`, 'Content-Type': 'application/json' },\n    body: JSON.stringify({ query, variables }),\n  });\n  if (!response.ok) throw new Error(`GitHub GraphQL request failed (${response.status})`);\n  const payload = await response.json();\n  if (payload.errors) throw new Error('GitHub GraphQL returned errors');\n  return payload.data;\n}\n\nasync function releaseFromGitHub() {\n  const [owner, repo] = env.GITHUB_REPOSITORY.split('/');\n  const tag = env.RELEASE_TAG || env.GITHUB_REF_NAME;\n  const response = await request(`https://api.github.com/repos/${owner}/${repo}/releases/tags/${encodeURIComponent(tag)}`, {\n    headers: { Authorization: `Bearer ${env.GITHUB_TOKEN}`, Accept: 'application/vnd.github+json' },\n  });\n  if (!response.ok) throw new Error(`release lookup failed (${response.status})`);\n  return response.json();\n}\n\nasync function createOrFindReleaseDiscussion() {\n  const release = await releaseFromGitHub();\n  const [owner, name] = env.GITHUB_REPOSITORY.split('/');\n  const marker = releaseMarker(release.tag_name);\n  const data = await githubGraphql(","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/scripts/discord/release-announce.mjs#L19-L55","documentation":"githubGraphql received a 200 response whose payload contained a top-level `errors` array, meaning GraphQL executed but the query failed (e.g. bad token scope, missing node). The error details are in the discarded payload.","triggerScenarios":"Triggered when release-announce.mjs rejects the current invocation: GitHub GraphQL returned errors","commonSituations":"Occurs while running scripts/discord/release-announce.mjs with invalid arguments, missing flags, or a failing external dependency; the guard at scripts/discord/release-announce.mjs:37 aborts the command with this message.","solutions":["Inspect the underlying error detail in the message (stderr/log/HTTP status), fix the cause, and retry."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06c5e118c4d3e6c3b7f9445f973a2194c82de193","analyzedAt":"2026-08-18T11:27:13.915Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}