Skip to content

[BUG]: Truncates stack traces from failed requests #660

@andersk

Description

@andersk

What happened?

With @octokit/plugin-retry installed, the stack trace from a failed request does not show the calling function (here outer). This makes it hard to track down where the error originates in a large project.

This is due to the bottleneck library (which seems to be unmaintained, perhaps a replacement should be investigated):

Same issue in @octokit/plugin-throttling:

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

const MyOctokit = Octokit.plugin(retry);
const octokit = new MyOctokit();

async function outer() {
  await octokit.users.getByUsername({
    username: "_invalid",
  });
}

await outer();

Versions

@octokit/rest 22.0.1, @octokit/plugin-retry 8.0.3, Node.js 22.21.1

Relevant log output

GET /users/_invalid - 404 with id D94A:386120:21016F97:21FFE1A9:6953031E in 238ms
file:///tmp/octokit-test/node_modules/@octokit/request/dist-bundle/index.js:123
    throw new RequestError(toErrorMessage(octokitResponse.data), status, {
          ^

RequestError [HttpError]: Not Found - https://docs.github.com/rest
    at fetchWrapper (file:///tmp/octokit-test/node_modules/@octokit/request/dist-bundle/index.js:123:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async requestWithGraphqlErrorHandling (file:///tmp/octokit-test/node_modules/@octokit/plugin-retry/dist-bundle/index.js:36:20)
    at async Job.doExecute (/tmp/octokit-test/node_modules/bottleneck/light.js:405:18) {
  status: 404,
  request: {
    method: 'GET',
    url: 'https://api.github.com/users/_invalid',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-rest.js/22.0.1 octokit-core.js/7.0.6 Node.js/22'
    },
    request: { hook: [Function: bound bound register] }
  },
  response: {
    url: 'https://api.github.com/users/_invalid',
    status: 404,
    headers: {
      'access-control-allow-origin': '*',
      'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
      'content-encoding': 'gzip',
      'content-length': '101',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Mon, 29 Dec 2025 22:39:26 GMT',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'github.com',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'x-github-api-version-selected': '2022-11-28',
      'x-github-media-type': 'github.v3; format=json',
      'x-github-request-id': 'D94A:386120:21016F97:21FFE1A9:6953031E',
      'x-ratelimit-limit': '60',
      'x-ratelimit-remaining': '59',
      'x-ratelimit-reset': '1767051566',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '1',
      'x-xss-protection': '0'
    },
    data: {
      message: 'Not Found',
      documentation_url: 'https://docs.github.com/rest',
      status: '404'
    }
  },
  [cause]: undefined
}

Node.js v22.21.1

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