Skip to content

[BUG]: 404 being retried #576

@steveoh

Description

@steveoh

What happened?

a 404 response code is being retried even though the docs say it shouldn't be.

Retries requests for server 4xx/5xx responses except 400, 401, 403, 404, 422, and 451.

this is how i create the client

import { Octokit } from '@octokit/rest';
import { retry } from '@octokit/plugin-retry';

const EnhancedOctokit = Octokit.plugin(retry);
const octokit = new EnhancedOctokit({
  auth: GITHUB_TOKEN,
  request: { retries: 9 },
});

I've tried adding the codes specifically but that doesn't affect anything

retry: {
    doNotRetry: [400, 401, 403, 404, 422, 451],
  },

Making any of those a string value makes the script run really slow which may be another issue.

This is the function call that 404's and retries 9 times.

const { data } = await octokit.rest.repos.getContent({ owner, repo, path });

Am I doing something wrong?

Versions

npmPackages:
@octokit/plugin-retry: ^7.1.1 => 7.1.1
@octokit/plugin-throttling: ^9.3.1 => 9.3.1
@octokit/rest: ^21.0.2 => 21.0.2
prettier: ^3.3.3 => 3.3.3
Binaries:
Node: 20.12.2 - ~/.local/state/fnm_multishells/1026_1726157267087/bin/node
npm: 10.8.2 - ~/.local/state/fnm_multishells/1026_1726157267087/bin/npm

Relevant log output

GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F268C:3F522F4:66E37921 in 174ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2709:3F523DB:66E37923 in 162ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2777:3F524C2:66E37923 in 167ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F27EE:3F5258D:66E37923 in 169ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F286F:3F52686:66E37923 in 225ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2911:3F527A8:66E37923 in 173ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2989:3F52881:66E37924 in 307ms
GET /orgs/agrc/actions/permissions/selected-actions - 409 with id B0C6:8B43D:E2219C:1AF6512:66E37920 in 155ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2A66:3F52A37:66E37924 in 169ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2AEB:3F52B2B:66E37924 in 181ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2B77:3F52C23:66E37924 in 151ms

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Up for grabsIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documented

    Type

    No type

    Projects

    Status

    🔥 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions