{"record":{"id":"6d83fe223ab1c92f","repo":"affaan-m/ECC","slug":"github-configuration-is-missing","errorCode":null,"errorMessage":"GitHub configuration is missing","messagePattern":"GitHub configuration is missing","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/discord/release-announce.mjs","lineNumber":204,"sourceCode":"  const receipt = findDiscordReceipt(recent, key);\n  if (receipt) {\n    await discord('PUT', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/pins/${receipt.id}`);\n    console.log('announcement already delivered; pin verified');\n    return;\n  }\n  const message = await discord('POST', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/messages`, buildDiscordPayload({\n    title: discussion.title,\n    body: discussion.body,\n    url: discussion.url,\n    key,\n  }));\n  await discord('PUT', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/pins/${message.id}`);\n  console.log('announcement delivered and pinned');\n}\n\nasync function main() {\n  if (!env.GITHUB_REPOSITORY) throw new Error('GitHub repository configuration is missing');\n  if ((env.ANNOUNCEMENT_KIND === 'release' || env.ANNOUNCEMENT_KIND === 'manual') && !env.GITHUB_TOKEN) throw new Error('GitHub configuration is missing');\n  const discussion = env.ANNOUNCEMENT_KIND === 'release'\n    ? await createOrFindReleaseDiscussion()\n    : env.ANNOUNCEMENT_KIND === 'manual'\n      ? await discussionFromGitHub()\n      : discussionFromEnvironment();\n  await deliver(discussion);\n}\n\nmain().catch(error => {\n  console.error(`release-announce failed: ${error.message}`);\n  process.exitCode = 1;\n});\n","sourceCodeStart":186,"sourceCodeEnd":217,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/discord/release-announce.mjs#L186-L217","documentation":"For ANNOUNCEMENT_KIND of 'release' or 'manual', the script must call the GitHub API (create/find the discussion or fetch its body), which requires GITHUB_TOKEN. It throws this error when the kind requires API access but no token is configured. Note the message omits 'repository' — it is the token check, distinct from error 774.","triggerScenarios":"main() runs with ANNOUNCEMENT_KIND set to 'release' or 'manual' while GITHUB_TOKEN is unset or empty. 'environment'-kind announcements that build purely from env vars do not hit this check.","commonSituations":"Workflow lacks `permissions: discussions: write` / token secret; a manual announcement triggered with only Discord secrets; GITHUB_TOKEN renamed in env.","solutions":["Add GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} to the workflow env","Grant the job `discussions: write` permission if using the default token","Set ANNOUNCEMENT_KIND to 'environment' if GitHub API access is genuinely not needed"],"exampleFix":"// before\nenv: { ANNOUNCEMENT_KIND: release }\n// after\nenv: { ANNOUNCEMENT_KIND: release, GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} }","handlingStrategy":"validation","validationCode":"if (['release','manual'].includes(process.env.ANNOUNCEMENT_KIND) && !process.env.GITHUB_TOKEN) throw new Error('ANNOUNCEMENT_KIND=release|manual requires GITHUB_TOKEN');","typeGuard":"const kindNeedsToken = (kind) => kind === 'release' || kind === 'manual';","tryCatchPattern":"try { await main(); } catch (e) { if (e.message === 'GitHub configuration is missing') { console.error('Add GITHUB_TOKEN (with discussions:write) to the workflow env'); process.exit(1); } throw e; }","preventionTips":["Grant the job `permissions: discussions: write` when using the default GITHUB_TOKEN","Only use ANNOUNCEMENT_KIND=environment if you truly need no GitHub API access","Pair every release/manual announcement trigger with a token secret in the same job"],"tags":["github","configuration","token"],"backgroundTag":"missing-required-config-field","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}