Skip to content

undici: Since v26 reading body from fetched 301 response throws aborted exception #67996

Backlog

Description

@Eptagone

Version

v26.14.0

Platform

Darwin Bender.local 27.2.0 Darwin Kernel Version 27.2.0: Wed Oct 14 23:43:44 PDT 2026; root:xnu-13432.41.4~25/RELEASE_ARM64_T8122 arm64

Subsystem

undici

What steps will reproduce the bug?

Try to fetch from an API that returns a JSON response with status 301 and without Location header.

// test.js
// Example:
// Status code: 301
// Headers: { Content-Type: "application/json" }
// Body: { type: 'redirect', data: 'http://node.org' }
const response = await fetch(
    "https://free.mockerapi.com/mock/f2145757-0e1b-4811-87e4-ec54aaa9ab88",
);
const json = await response.json();
console.log("Response:", json);
node ./test.js

How often does it reproduce? Is there a required condition?

It works fine with Node 24. It fails with Node 26.

What is the expected behavior? Why is that the expected behavior?

The response body to de deserialized

What do you see instead?

It thorws the following error:

node:internal/deps/undici/undici:15214
            fetchParams.controller.controller.error(new TypeError("terminated", {
                                                    ^

TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:15214:53)
    at Fetch.emit (node:events:514:20)
    at Fetch.terminate (node:internal/deps/undici/undici:14330:14)
    at fetchParams.controller.resume (node:internal/deps/undici/undici:15188:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5) {
  [cause]: DOMException [AbortError]: The operation was aborted.
      at new DOMException (node:internal/per_context/domexception:79:18)
      at Object.destroy (node:internal/deps/undici/undici:15070:33)
      at httpFetch (node:internal/deps/undici/undici:14833:45)
      at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
      at async mainFetch (node:internal/deps/undici/undici:14567:24)
}

Additional information

No response

Activity

  1. changed the title [-]Since v26 reading body from fetched response throws aborted exception[/-] [+]Since v26 reading body from fetched 301 response throws aborted exception[/+] on Dec 3, 2026
  2. changed the title [-]Since v26 reading body from fetched 301 response throws aborted exception[/-] [+]undici: Since v26 reading body from fetched 301 response throws aborted exception[/+] on Dec 3, 2026
  3. Renegade334 commented on Dec 3, 2026

    @Renegade334
    Member
  4. added
    fetch
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fetch

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions