Title: retries input retries the codes in retry-exempt-status-codes (403/404/422 are sent retries+1 times) · Issue #732 · actions/github-script · GitHub
Open Graph Title: retries input retries the codes in retry-exempt-status-codes (403/404/422 are sent retries+1 times) · Issue #732 · actions/github-script
X Title: retries input retries the codes in retry-exempt-status-codes (403/404/422 are sent retries+1 times) · Issue #732 · actions/github-script
Description: Describe the bug When retries is set, a response with a status listed in retry-exempt-status-codes is still retried, immediately and up to retries times. With retries: 3, a 403, 404 or 422 is sent 4 times. The README and the input descri...
Open Graph Description: Describe the bug When retries is set, a response with a status listed in retry-exempt-status-codes is still retried, immediately and up to retries times. With retries: 3, a 403, 404 or 422 is sent ...
X Description: Describe the bug When retries is set, a response with a status listed in retry-exempt-status-codes is still retried, immediately and up to retries times. With retries: 3, a 403, 404 or 422 is sent ...
Opengraph URL: https://github.com/actions/github-script/issues/732
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"retries input retries the codes in retry-exempt-status-codes (403/404/422 are sent retries+1 times)","articleBody":"**Describe the bug**\n\nWhen `retries` is set, a response with a status listed in `retry-exempt-status-codes` is still retried, immediately and up to `retries` times. With `retries: 3`, a 403, 404 or 422 is sent 4 times. The README and the input description say those codes are not retried.\n\nThe cause is how `getRetryOptions` (src/retry-options.ts) passes the count. It puts the count in `request.retries` and the exempt list in `retry.doNotRetry`. In `@octokit/plugin-retry` 8.1.0, `errorRequest` honours `doNotRetry`: for an exempt status it rethrows without scheduling a retry. But the `failed` handler in `wrapRequest` reads `error.request.request.retries` for every error. That is the `request.retries` value github-script set, so the limiter retries anyway. `retryAfter` is unset on that path, so the delay is 0.\n\nIf the count is passed as `retry: { retries }` instead, and `request.retries` is left unset, the exempt list is honoured.\n\nThe same root cause is reported upstream as octokit/plugin-retry.js#576 (\"404 being retried\", open since 2024-09; the reporter sets `request: { retries: 9 }`).\n\n**To Reproduce**\n\nThis is the option shape github-script v9.0.0 builds for `retries: 3` with the default exempt codes, run against `@octokit/core` 7 and `@octokit/plugin-retry` 8.1.0 (the versions in its lockfile). It uses a stub fetch:\n\n```js\nimport { Octokit } from '@octokit/core';\nimport { retry } from '@octokit/plugin-retry';\n\nasync function run(label, status, opts) {\n let calls = 0;\n const fetch = async () => {\n calls++;\n return new Response('{\"message\":\"x\"}', { status, headers: { 'content-type': 'application/json' } });\n };\n const O = Octokit.plugin(retry);\n const o = new O({ ...opts, request: { ...opts.request, fetch } });\n await o.request('GET /repos/a/b').catch(() => {});\n console.log(label, status, 'calls:', calls);\n}\n\n// What github-script builds for `retries: 3`\nconst githubScript = { retry: { enabled: true, doNotRetry: [400, 401, 403, 404, 422] }, request: { retries: 3 } };\n// Count in the retry options instead\nconst retryOptions = { retry: { enabled: true, retries: 3, doNotRetry: [400, 401, 403, 404, 422] } };\n\nawait run('github-script shape', 403, githubScript);\nawait run('github-script shape', 404, githubScript);\nawait run('github-script shape', 422, githubScript);\nawait run('retry.retries shape', 403, retryOptions);\n```\n\nOutput:\n\n```\ngithub-script shape 403 calls: 4\ngithub-script shape 404 calls: 4\ngithub-script shape 422 calls: 4\nretry.retries shape 403 calls: 1\n```\n\nThe `retry.retries` shape still retries a 502 with the 1 s / 4 s / 9 s backoff.\n\n**Expected behavior**\n\nA status in `retry-exempt-status-codes` is sent once. This matters most for 403. With `retries` set, a rate-limited or forbidden request is sent again at once, several times. It also delays every 404 a script expects and handles.\n\n**Possible fix**\n\nIn `getRetryOptions`, put the count in the retry options (`retryOptions.retries = retries`) rather than in `requestOptions.retries`. The secondary clients from the injected `getOctokit` would inherit it through `createConfiguredGetOctokit` unchanged.\n\n**Workaround**\n\nLeave `retries` at 0 and build clients with the injected `getOctokit(token, { retry: { enabled: true, retries: 3 } })`. In v9 the plugin is always attached and the merged `retry` options enable it.\n\n**Versions**\n\n- actions/github-script v9.0.0 (d746ffe35508b1917358783b479e04febd2b8f71)\n- @octokit/plugin-retry 8.1.0, @octokit/core 7.0.6, @octokit/request 10.0.8 (from the v9.0.0 package-lock.json)\n- Reproduced with Node 22\n","author":{"url":"https://github.com/pleberre","@type":"Person","name":"pleberre"},"datePublished":"2026-11-04T16:50:05Z","url":"https://github.com/actions/github-script/issues/732"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:10bb05e7-af4c-f126-6a3f-fd23572d9cba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 996C:1C94F:2228A24:2BCA630:6B01C385 |
| html-safe-nonce | 2ae28833e15301ee9395995ce4ae96f3ae5c09f7d90f56186b876a7089c6ccd2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTZDOjFDOTRGOjIyMjhBMjQ6MkJDQTYzMDo2QjAxQzM4NSIsInZpc2l0b3JfaWQiOiIzNDI5ODgxNzc5NjczMjE5OTc0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b1218ea7e29489e4d3dd330b80d232619593b8b20d95c33213c727ebddd2b758 |
| hovercard-subject-tag | issue:6207268144 |
| github-keyboard-shortcuts | repository,issues,actions,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/actions/github-script/732/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6abad13a0ec3fc5121ea25e0cd2ec41932b768ff9bc9ee2e7123014c0558d78b/actions/github-script/issues/732 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6abad13a0ec3fc5121ea25e0cd2ec41932b768ff9bc9ee2e7123014c0558d78b/actions/github-script/issues/732 |
| og:image:alt | Describe the bug When retries is set, a response with a status listed in retry-exempt-status-codes is still retried, immediately and up to retries times. With retries: 3, a 403, 404 or 422 is sent ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pleberre |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/actions/github-script git https://github.com/actions/github-script.git |
| octolytics-dimension-user_id | 44036562 |
| octolytics-dimension-user_login | actions |
| octolytics-dimension-repository_id | 205262760 |
| octolytics-dimension-repository_nwo | actions/github-script |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 205262760 |
| octolytics-dimension-repository_network_root_nwo | actions/github-script |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width