Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
A stream ended or was destroyed before it finished — often a client disconnect or upstream aborting a download.
Seen on:
Node.js
Meaning
stream.pipeline/finished report this when a source or destination closes early. In HTTP servers it means the client went away; in clients it means the server cut the response.
Common causes
- Client aborted the request
- Upstream closed the response early
- Destroying a stream manually before it finished
⚡ Quick fix
- Treat it as a client-abort in servers (don’t log as an error)
- Retry downloads
- Use stream.pipeline to clean up properly
Detailed fix by platform
Node.js
await pipeline(src, transform, dest); // rejects on premature close
How to diagnose
- Side — Which end closed?
- Timing — Client navigated away?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026