affaan-m/ECC · error · Error

discussion receipt lookup failed

Error message

discussion receipt lookup failed

What it means

Thrown by findReceiptComment when retrieving prior comments on the discussion fails, so the script cannot check whether the Discord announcement was already delivered. Idempotency depends on reading this receipt.

Source

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

  if (!/^\d+$/.test(env.DISCUSSION_NUMBER || '')) throw new Error('discussion number is invalid');
  const response = await request(`https://api.github.com/repos/${env.GITHUB_REPOSITORY}/discussions/${env.DISCUSSION_NUMBER}`, {
    headers: { Authorization: `Bearer ${env.GITHUB_TOKEN}`, Accept: 'application/vnd.github+json' },
  });
  if (!response.ok) throw new Error(`discussion lookup failed (${response.status})`);
  const discussion = await response.json();
  if (discussion.category?.name !== 'Announcements') throw new Error('discussion is not an Announcement');
  return { id: discussion.node_id, title: discussion.title, body: discussion.body, url: discussion.html_url };
}

async function findReceiptComment(discussionId, marker) {
  let cursor = null;
  for (let page = 0; page < 50; page += 1) {
    const data = await githubGraphql(
      `query($id:ID!,$after:String){node(id:$id){... on Discussion{comments(first:100,after:$after){nodes{id body author{login}} pageInfo{hasNextPage endCursor}}}}}`,
      { id: discussionId, after: cursor },
    );
    const comments = data.node?.comments;
    if (!comments) throw new Error('discussion receipt lookup failed');
    const receipt = findDiscussionReceipt(comments.nodes, marker);
    if (receipt) return receipt;
    if (!comments.pageInfo.hasNextPage) return null;
    cursor = comments.pageInfo.endCursor;
  }
  throw new Error('discussion receipt lookup exceeded page budget');
}

async function addReceiptComment(discussionId, body) {
  const data = await githubGraphql(
    `mutation($id:ID!,$body:String!){addDiscussionComment(input:{discussionId:$id,body:$body}){comment{id}}}`,
    { id: discussionId, body },
  );
  return data.addDiscussionComment.comment.id;
}

async function deleteReceiptComment(commentId) {
  await githubGraphql(

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: discussion receipt lookup failed

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


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