{"record":{"id":"2e10f3d2ba23847e","repo":"affaan-m/ECC","slug":"announcement-delivered-pending-receipt-cleanup-re","errorCode":null,"errorMessage":"announcement delivered; pending receipt cleanup requires attention","messagePattern":"announcement delivered; pending receipt cleanup requires attention","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/discord/release-announce.mjs","lineNumber":177,"sourceCode":"      throw new Error('announcement has a pending receipt; inspect Discord before clearing it');\n    }\n    const claimId = await addReceiptComment(discussion.id, `${marker}\\n\\nDiscord delivery: pending.`);\n    const payload = buildDiscordPayload({ title: discussion.title, body: discussion.body, url: discussion.url, key });\n    delete payload.nonce;\n    delete payload.enforce_nonce;\n    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,","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/scripts/discord/release-announce.mjs#L159-L195","documentation":"Discord release-announce report: the webhook POST succeeded, so the announcement was delivered, but a pre-existing 'pending' receipt marker could not be safely cleared and needs a human to inspect Discord. Delivery worked; only receipt bookkeeping requires attention.","triggerScenarios":"Thrown at scripts/discord/release-announce.mjs:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Manually clean up the pending receipts in the state file.","Re-run the announcement script's cleanup step after fixing the underlying error."],"exampleFix":null,"handlingStrategy":"fallback","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"}