cli icon indicating copy to clipboard operation
cli copied to clipboard

Error: `Cannot write headers after they are sent to` when running `netlify dev`

Open dylanhs opened this issue 3 months ago • 0 comments

Describe the bug

› Error: Netlify CLI has terminated unexpectedly This is a problem with the Netlify CLI, not with your application. If you recently updated the CLI, consider reverting to an older version by running:

npm install -g netlify-cli@VERSION

You can use any version from https://ntl.fyi/cli-versions.

Please report this problem at https://ntl.fyi/cli-error including the error details below.

Error: Cannot write headers after they are sent to the client at ServerResponse.writeHead (node:_http_server:352:11) at ProxyServer. (file:///home/dylanhs/.nvm/versions/node/v24.1.0/lib/node_modules/netlify-cli/src/utils/proxy.ts:549:11) at ProxyServer.emit (/home/dylanhs/.nvm/versions/node/v24.1.0/lib/node_modules/netlify-cli/node_modules/eventemitter3/index.js:210:27) at ClientRequest.proxyError (/home/dylanhs/.nvm/versions/node/v24.1.0/lib/node_modules/netlify-cli/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:165:18) at ClientRequest.emit (node:events:507:28) at emitErrorEvent (node:_http_client:104:11) at Socket.socketErrorListener (node:_http_client:518:5) at Socket.emit (node:events:507:28) at emitErrorNT (node:internal/streams/destroy:170:8) at emitErrorCloseNT (node:internal/streams/destroy:129:3)

System: OS: Linux 6.6 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish) CPU: (12) x64 AMD Ryzen 5 5500U with Radeon Graphics Binaries: Node: 24.1.0 - ~/.nvm/versions/node/v24.1.0/bin/node Yarn: 1.22.22 - ~/.nvm/versions/node/v24.1.0/bin/yarn npm: 11.3.0 - ~/.nvm/versions/node/v24.1.0/bin/npm npmGlobalPackages: netlify-cli: 23.10.0

Steps to reproduce

  1. Run netlify dev.

Configuration

No response

Environment

System: OS: Linux 6.6 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish) CPU: (12) x64 AMD Ryzen 5 5500U with Radeon Graphics Memory: 11.48 GB / 18.47 GB Container: Yes Shell: 5.1.16 - /bin/bash Binaries: Node: 24.1.0 - /home/dylanhs/.nvm/versions/node/v24.1.0/bin/node Yarn: 1.22.22 - /home/dylanhs/.nvm/versions/node/v24.1.0/bin/yarn npm: 11.3.0 - /home/dylanhs/.nvm/versions/node/v24.1.0/bin/npm npmGlobalPackages: netlify-cli: 23.10.0

dylanhs avatar Nov 08 '25 16:11 dylanhs