affaan-m/ECC · error

GitHub GraphQL request failed (${response.status})

Error message

GitHub GraphQL request failed (${response.status})

What it means

githubGraphql received a non-OK HTTP status from the GitHub GraphQL endpoint after the shared retry loop exhausted its 429 backoff attempts; the status code is embedded. Causes include bad tokens, rate limits, and GitHub outages.

Source

Thrown at scripts/discord/release-announce.mjs:35

const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));

async function request(url, options = {}, attempts = 3) {
  for (let attempt = 1; attempt <= attempts; attempt += 1) {
    const response = await fetch(url, options);
    if (response.status !== 429 || attempt === attempts) return response;
    const data = await response.json().catch(() => ({}));
    await sleep(Math.min(Number(data.retry_after || 1) * 1000 + 250, 10_000));
  }
  throw new Error('request retry budget exhausted');
}

async function githubGraphql(query, variables) {
  const response = await request('https://api.github.com/graphql', {
    method: 'POST',
    headers: { Authorization: `Bearer ${env.GITHUB_TOKEN}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({ query, variables }),
  });
  if (!response.ok) throw new Error(`GitHub GraphQL request failed (${response.status})`);
  const payload = await response.json();
  if (payload.errors) throw new Error('GitHub GraphQL returned errors');
  return payload.data;
}

async function releaseFromGitHub() {
  const [owner, repo] = env.GITHUB_REPOSITORY.split('/');
  const tag = env.RELEASE_TAG || env.GITHUB_REF_NAME;
  const response = await request(`https://api.github.com/repos/${owner}/${repo}/releases/tags/${encodeURIComponent(tag)}`, {
    headers: { Authorization: `Bearer ${env.GITHUB_TOKEN}`, Accept: 'application/vnd.github+json' },
  });
  if (!response.ok) throw new Error(`release lookup failed (${response.status})`);
  return response.json();
}

async function createOrFindReleaseDiscussion() {
  const release = await releaseFromGitHub();
  const [owner, name] = env.GITHUB_REPOSITORY.split('/');

View on GitHub (pinned to 06c5e118c4)

Solutions

  1. Inspect the underlying error detail in the message (stderr/log/HTTP status), fix the cause, and retry.
Defensive patterns

Strategy: retry

When it happens

Trigger: Triggered when release-announce.mjs rejects the current invocation: GitHub GraphQL request failed (<value>)

Common situations: 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:35 aborts the command with this message.


AI-assisted analysis of affaan-m/ECC@06c5e118c4 (2026-08-18). Data as JSON: /api/errors/27c6381b6a829a70. Report an issue: GitHub.