Error: `Cannot write headers after they are sent to` when running `netlify dev`
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.
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
- 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