curl: (18) transfer closed with outstanding read data remaining
The connection closed before the body finished
Seen in curl, libcurl (CURLE_PARTIAL_FILE), Git over HTTPS
The server or something in between closed the connection before sending the full response body it announced.
Common causes
- The application crashed or was killed mid-response, so the Content-Length or chunked body was cut short.
- A proxy, load balancer or CDN timed out a slow or large response and closed the connection.
- A wrong Content-Length header that is larger than the body actually sent.
- An unstable network path dropping a long transfer.
How to fix it
- Check application and proxy logs at the time of the request for crashes or timeouts.
- Raise idle and response timeouts on the proxy or load balancer for large downloads.
- Make sure the application does not set Content-Length by hand when compression or middleware changes the body.
- Retry with -C - to resume a large download, and compare from another network.
Got a different message? Paste it into the error explainer.
Related errors
- curl: (22) The requested URL returned error · The server answered with an HTTP error status
- curl: (47) Maximum (50) redirects followed · curl stopped in a redirect loop
- curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1) · The server reset an HTTP/2 stream
- 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
- curl: (7) Failed to connect · The connection was refused or unreachable
- curl: (28) Operation timed out · The request timed out
- curl: (51) SSL: no alternative certificate subject name matches target host name · The certificate doesn't match the hostname