affaan-m/ECC · error · Error

Discord webhook request failed (${response.status})

Error message

Discord webhook request failed (${response.status})

What it means

Posting the announcement to the configured Discord webhook returned a non-OK status (invalid webhook, expired URL, or Discord error); the pending receipt claim is deleted before this throws so no half-delivered state remains.

Source

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

    if (existingReceipt) {
      if (discussionReceiptStatus(existingReceipt) === 'complete') {
        console.log('announcement already delivered');
        return;
      }
      throw new Error('announcement has a pending receipt; inspect Discord before clearing it');
    }
    const claimId = await addReceiptComment(discussion.id, `${marker}\n\nDiscord delivery: pending.`);
    const payload = buildDiscordPayload({ title: discussion.title, body: discussion.body, url: discussion.url, key });
    delete payload.nonce;
    delete payload.enforce_nonce;
    const response = await request(webhookUrl, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(payload),
    });
    if (!response.ok) {
      await deleteReceiptComment(claimId);
      throw new Error(`Discord webhook request failed (${response.status})`);
    }
    const message = await response.json();
    await addReceiptComment(discussion.id, `${marker}\n\nDiscord delivery: complete (message ${message.id}).`);
    await deleteReceiptComment(claimId).catch(() => {
      console.warn('announcement delivered; pending receipt cleanup requires attention');
    });
    console.log('announcement delivered by channel webhook');
    return;
  }
  if (!env.DISCORD_BOT_TOKEN || !/^\d{10,25}$/.test(env.DISCORD_ANNOUNCE_CHANNEL_ID || '')) {
    throw new Error('Discord announcement credentials are missing or invalid');
  }
  const recent = await discord('GET', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/messages?limit=100`);
  const receipt = findDiscordReceipt(recent, key);
  if (receipt) {
    await discord('PUT', `/channels/${env.DISCORD_ANNOUNCE_CHANNEL_ID}/pins/${receipt.id}`);
    console.log('announcement already delivered; pin verified');
    return;

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: Discord webhook 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:172 aborts the command with this message.


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