{"record":{"id":"6042b1ec305363c5","repo":"affaan-m/ECC","slug":"discord-announcement-credentials-are-missing-or-in","errorCode":null,"errorMessage":"Discord announcement credentials are missing or invalid","messagePattern":"Discord announcement credentials are missing or invalid","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/discord/release-announce.mjs","lineNumber":183,"sourceCode":"    const response = await request(webhookUrl, {\n      method: 'POST',\n      headers: { 'Content-Type': 'application/json' },\n      body: JSON.stringify(payload),\n    });\n    if (!response.ok) {\n      await deleteReceiptComment(claimId);\n      throw new Error(`Discord webhook request failed (${response.status})`);\n    }\n    const message = await response.json();\n    await addReceiptComment(discussion.id, `${marker}\\n\\nDiscord delivery: complete (message ${message.id}).`);\n    await deleteReceiptComment(claimId).catch(() => {\n      console.warn('announcement delivered; pending receipt cleanup requires attention');\n    });\n    console.log('announcement delivered by channel webhook');\n    return;\n  }\n  if (!env.DISCORD_BOT_TOKEN || !/^\\d{10,25}$/.test(env.DISCORD_ANNOUNCE_CHANNEL_ID || '')) {\n    throw new Error('Discord announcement credentials are missing or invalid');\n  }\n  const recent = await discord('GET', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/messages?limit=100`);\n  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","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/scripts/discord/release-announce.mjs#L165-L201","documentation":"deliver validates Discord credentials (bot token and announce channel id) before sending; they are absent or rejected, so no announcement can be posted. This guard also covers the channel lookup returning unusable data.","triggerScenarios":"Triggered when release-announce.mjs rejects the current invocation: Discord announcement credentials are missing or invalid","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:183 aborts the command with this message.","solutions":["Provide valid credentials/configuration or wait for the rate-limit reset; verify permissions/role."],"exampleFix":null,"handlingStrategy":"validation","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"}