{"record":{"id":"0e42df15f4267f34","repo":"microsoft/TypeScript","slug":"failed-to-update-status-comment","errorCode":null,"errorMessage":"Failed to update status comment","messagePattern":"Failed to update status comment","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/post-vsts-artifact-comment.mjs","lineNumber":110,"sourceCode":"        break;\r\n    }\r\n\r\n    const newComment = oldComment.replace(toReplace, `[${emoji} Results](${resultsComment.data.html_url})`);\r\n\r\n    // Update status comment\r\n    await gh.rest.issues.updateComment({\r\n        comment_id: STATUS_COMMENT,\r\n        owner: \"microsoft\",\r\n        repo: \"TypeScript\",\r\n        body: newComment,\r\n    });\r\n\r\n    // Repeat; someone may have edited the comment at the same time.\r\n    await new Promise(resolve => setTimeout(resolve, 1000));\r\n}\r\n\r\nif (!posted) {\r\n    throw new Error(\"Failed to update status comment\");\r\n}\r\n","sourceCodeStart":92,"sourceCodeEnd":112,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/scripts/post-vsts-artifact-comment.mjs#L92-L112","documentation":"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.","triggerScenarios":"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.","commonSituations":"Expired or under-scoped GITHUB_TOKEN in CI; rate limiting during heavy release windows; STATUS_COMMENT id no longer exists on the issue.","solutions":["Verify the token has `issues:write`/comment-write scope and hasn't expired.","Confirm STATUS_COMMENT id still maps to an existing comment on the target issue.","Wait out any rate limit and re-run the job once GitHub is healthy.","Inspect earlier log lines for the HTTP status returned by the API."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-flight: confirm the comment exists and token works before the update loop.\ntry {\n  await gh.rest.issues.getComment({ comment_id: STATUS_COMMENT, owner: \"microsoft\", repo: \"TypeScript\" });\n} catch (e) {\n  core.setFailed(`Status comment ${STATUS_COMMENT} not reachable: ${e.message}`);\n}","typeGuard":null,"tryCatchPattern":"for (let attempt = 0; attempt < 3; attempt++) {\n  try {\n    await gh.rest.issues.updateComment({ comment_id: STATUS_COMMENT, owner: \"microsoft\", repo: \"TypeScript\", body: newComment });\n    posted = true; break;\n  } catch (e) {\n    if (e.status === 403 || e.status === 429) { await new Promise(r => setTimeout(r, 1000 * (attempt + 1))); continue; }\n    throw e;\n  }\n}","preventionTips":["Use a token with comment-write scope and rotate it before expiry.","Treat 403/429 as retryable with exponential backoff.","Verify STATUS_COMMENT id maps to a live comment before the run."],"tags":["ci","github-api","network","release","retry"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}