microsoft/TypeScript · error · Error

Failed to update status comment

Error message

Failed to update status comment

What it means

post-vsts-artifact-comment.mjs updates a pinned GitHub issue comment (STATUS_COMMENT) via the GitHub REST API, retrying once after a 1s delay. If no update succeeds, `posted` stays false and the script throws to surface the CI failure.

Source

Thrown at scripts/post-vsts-artifact-comment.mjs:110

        break;
    }

    const newComment = oldComment.replace(toReplace, `[${emoji} Results](${resultsComment.data.html_url})`);

    // Update status comment
    await gh.rest.issues.updateComment({
        comment_id: STATUS_COMMENT,
        owner: "microsoft",
        repo: "TypeScript",
        body: newComment,
    });

    // Repeat; someone may have edited the comment at the same time.
    await new Promise(resolve => setTimeout(resolve, 1000));
}

if (!posted) {
    throw new Error("Failed to update status comment");
}

View on GitHub (pinned to b465fdbfe1)

Solutions

  1. Verify the token has `issues:write`/comment-write scope and hasn't expired.
  2. Confirm STATUS_COMMENT id still maps to an existing comment on the target issue.
  3. Wait out any rate limit and re-run the job once GitHub is healthy.
  4. Inspect earlier log lines for the HTTP status returned by the API.
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: confirm the comment exists and token works before the update loop.
try {
  await gh.rest.issues.getComment({ comment_id: STATUS_COMMENT, owner: "microsoft", repo: "TypeScript" });
} catch (e) {
  core.setFailed(`Status comment ${STATUS_COMMENT} not reachable: ${e.message}`);
}

Try / catch

for (let attempt = 0; attempt < 3; attempt++) {
  try {
    await gh.rest.issues.updateComment({ comment_id: STATUS_COMMENT, owner: "microsoft", repo: "TypeScript", body: newComment });
    posted = true; break;
  } catch (e) {
    if (e.status === 403 || e.status === 429) { await new Promise(r => setTimeout(r, 1000 * (attempt + 1))); continue; }
    throw e;
  }
}

Prevention

When it happens

Trigger: GitHub API returns an error for every updateComment attempt: auth failure, permission error, rate limit (429/403), the comment was deleted, or the runner has no network.

Common situations: Expired or under-scoped GITHUB_TOKEN in CI; rate limiting during heavy release windows; STATUS_COMMENT id no longer exists on the issue.

Related errors


AI-assisted analysis of microsoft/TypeScript@b465fdbfe1 (2026-08-12). Data as JSON: /api/errors/0e42df15f4267f34. Report an issue: GitHub.