Title: New ECONNRESET error on http.request for HTTP 413 (Node v24.16.0 regression) · Issue #64272 · nodejs/node · GitHub
Open Graph Title: New ECONNRESET error on http.request for HTTP 413 (Node v24.16.0 regression) · Issue #64272 · nodejs/node
X Title: New ECONNRESET error on http.request for HTTP 413 (Node v24.16.0 regression) · Issue #64272 · nodejs/node
Description: Version 24.18.0 Platform Linux Subsystem http What steps will reproduce the bug? Reproducible with the following standalone snippet: /* eslint-env qunit */ 'use script'; const http = require('http'); async function request (url, options)...
Open Graph Description: Version 24.18.0 Platform Linux Subsystem http What steps will reproduce the bug? Reproducible with the following standalone snippet: /* eslint-env qunit */ 'use script'; const http = require('http'...
X Description: Version 24.18.0 Platform Linux Subsystem http What steps will reproduce the bug? Reproducible with the following standalone snippet: /* eslint-env qunit */ 'use script'; const http = requir...
Opengraph URL: https://github.com/nodejs/node/issues/64272
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"New ECONNRESET error on http.request for HTTP 413 (Node v24.16.0 regression)","articleBody":"### Version\n\n24.18.0\n\n### Platform\n\n```text\nLinux\n```\n\n### Subsystem\n\nhttp\n\n### What steps will reproduce the bug?\n\nReproducible with the following standalone snippet:\n\n```js\n/* eslint-env qunit */\n'use script';\n\nconst http = require('http');\n\nasync function request (url, options) {\n return new Promise((resolve, reject) => {\n const req = http.request(url, {\n method: options.method,\n headers: options.headers\n }, (response) => {\n resolve(response);\n });\n // req.on('error', reject); // Adding this makes it work\n req.write(options.body);\n req.end();\n });\n}\n\n(async function() {\n const server = http.createServer();\n server.on('request', (request, response) => {\n console.log('server-request', request.url, request.headers);\n\n const MAX_BODY_LENGTH = 1024 * 1024;\n let body = '';\n request.setEncoding('utf8');\n request.on('data', function onData (chunk) {\n body += chunk;\n if (body.length > MAX_BODY_LENGTH) {\n // HTTP 413 Payload Too Large\n response.writeHead(413);\n response.end();\n request.off('data', onData);\n request.destroy();\n }\n });\n request.on('end', function onEnd () {\n response.writeHead(202);\n response.end();\n });\n });\n server.on('error', (err) => console.error('server-error', err));\n server.listen(0);\n await new Promise((resolve) => server.on('listening', resolve()));\n\n const address = `http://localhost:${server.address().port}`;\n const options = {\n method: 'POST',\n headers: {\n 'content-type': 'application/json'\n },\n body: JSON.stringify({\n a: 'x'.repeat(512 * 1024),\n b: 'x'.repeat(512 * 1024),\n c: 'x'.repeat(512 * 1024),\n d: 'x'.repeat(512 * 1024)\n }, null, '\\t')\n };\n\n try {\n // Works fine on Node v24.18.0\n // const resp = await fetch(address, options);\n // const data = await resp.text();\n // console.log(resp, data);\n\n // Works from Node v10.x to v24.15.x and fails in v24.16.x, v24.17.x, v24.18.x\n const resp = await request(address, options);\n console.log(resp.statusCode);\n } catch (e) {\n console.error(e);\n } finally {\n server.close();\n }\n}());\n```\n\n### How often does it reproduce? Is there a required condition?\n\nEvery time. No race condition.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nFrom Node v10 to v24.15.x this worked without any error.\n\n### What do you see instead?\n\nStarting in v24.16.x (including v24.17.x and latest v24.18.x) the client consistently experiences ECONNRESET.\n\n```\nnode:events:487\n throw er; // Unhandled 'error' event\n ^\n\nError: read ECONNRESET\n at TCP.onStreamRead (node:internal/stream_base_commons:216:20)\nEmitted 'error' event on ClientRequest instance at:\n at emitErrorEvent (node:_http_client:109:11)\n at Socket.socketErrorListener (node:_http_client:593:5)\n at Socket.emit (node:events:509:28)\n at emitErrorNT (node:internal/streams/destroy:170:8)\n at emitErrorCloseNT (node:internal/streams/destroy:129:3)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {\n errno: -104,\n code: 'ECONNRESET',\n syscall: 'read'\n}\n```\n\n\nI can and should handle this, although it is a no-op in practice because the Promise is already settled by `resolve()` with an HTTP 413 response.\n\nUnclear if a regression or intentional. I imagine this kind of naive `request()` implementation is a fairly common idiom for simple cases where no error is expected. Either in code that still needs to support Node.js 10 or where one simply hasn't yet had a reason to revisit it and switch to `fetch()`.\n\n### Additional information\n\nI found this when attempting to add Node.js 24 support to https://github.com/jquery/node-notifier-server/ which is a server for processing GitHub Webhooks. \n\nhttps://github.com/jquery/node-notifier-server/actions/runs/28656799866\n\nhttps://github.com/jquery/node-notifier-server/actions/runs/28657579964\n\n\nQUnit result:\n```\nTAP version 13\n# [notifier-server:debug] The notifier-server is listening on port 33765\nok 1 notifier-server > start server\n…\n# [notifier-server:debug] Including /tmp/notifiergY1g53/example.js\n# [notifier-server:debug] The notifier-server is listening on port 35017\nnot ok 15 notifier-server > notifier ignores too large json\n ---\n message: \"global failure: Error: read ECONNRESET\"\n severity: failed\n stack: |\n Error: read ECONNRESET\n at TCP.onStreamRead (node:internal/stream_base_commons:216:20)\n ...\n1..15\n# pass 14\n# skip 0\n# todo 0\n# fail 1\nError: Process completed with exit code 1.\n```","author":{"url":"https://github.com/Krinkle","@type":"Person","name":"Krinkle"},"datePublished":"2026-07-03T19:13:04Z","url":"https://github.com/nodejs/node/issues/64272"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| 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:3a0722ff-ad1b-e672-7469-144e5fe8df15 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E146:257A3D:875813:B43723:6AED2AA5 |
| html-safe-nonce | 440950a80c2fa68755109e9ab370984829c2c8496bd8fe8dfab292462804c47c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTQ2OjI1N0EzRDo4NzU4MTM6QjQzNzIzOjZBRUQyQUE1IiwidmlzaXRvcl9pZCI6IjczMDk5MDU0ODYyNzIwODA1NDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b4f818ff32aa3b9ed3e90269c4bbfa1b000c3ed4e93695336c67e0777dedc953 |
| hovercard-subject-tag | issue:4805812562 |
| github-keyboard-shortcuts | repository,issues,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/nodejs/node/64272/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d1fb9354409eb7c61a2c76b97ca145be963bd5356957a5d7dc6238ffd2db1298/nodejs/node/issues/64272 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d1fb9354409eb7c61a2c76b97ca145be963bd5356957a5d7dc6238ffd2db1298/nodejs/node/issues/64272 |
| og:image:alt | Version 24.18.0 Platform Linux Subsystem http What steps will reproduce the bug? Reproducible with the following standalone snippet: /* eslint-env qunit */ 'use script'; const http = require('http'... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Krinkle |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9d95365dda0576efe9b71f45807595e396bd0ca9286fba5367a05048e6ddf8f2 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| 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 | 98b41fa4b5635ceb45a4c54320fced73817ff290 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width