Error: write EPIPE
Wrote to a connection the other side had closed
Seen in Node.js, npm, child processes and pipes
Node.js tried to write to a socket or pipe after the other end had already closed it (broken pipe).
Common causes
- The server closed the connection, for example after rejecting a large upload or timing out, while the client was still sending.
- A keep-alive connection closed by the server and then reused.
- Writing to a child process or stdout pipe that has exited, such as piping into head.
How to fix it
- Check the server response or logs; a 413 or timeout often comes just before the EPIPE.
- Handle the error event on sockets and streams so one closed peer does not crash the process.
- Retry idempotent requests on a fresh connection.
Got a different message? Paste it into the error explainer.
Related errors
- curl: (3) URL using bad/illegal format or missing URL · curl could not parse the URL
- curl: (77) error setting certificate verify locations · curl can't read its CA certificate bundle
- unexpected eof while reading · The peer closed the connection without a TLS close
- TypeError: fetch failed · Node.js fetch failed below HTTP
- Error: listen EADDRINUSE: address already in use · Another process is already using the port
- Error: EMFILE: too many open files · The process ran out of file descriptors
- unable to get local issuer certificate · The client can't find the certificate's issuer
- unable to verify the first certificate · The intermediate certificate is missing
- certificate has expired · The server certificate has expired
- self signed certificate in certificate chain · The chain ends in an untrusted root
- wrong version number · TLS spoken to something that isn't TLS
- curl: (6) Could not resolve host · The hostname doesn't resolve