context deadline exceeded (Client.Timeout exceeded while awaiting headers)
The HTTP client timed out before the response
Seen in Go (net/http), Docker, Kubernetes, Prometheus, Terraform
The http.Client timeout expired before response headers arrived, whether the time went on connecting or on waiting for the server.
Common causes
- The server or an upstream is slow to respond.
- The connection itself is slow or blocked by a firewall, using up the whole timeout.
- A missing or unreachable proxy.
- The timeout set on http.Client is too short for this request.
How to fix it
- Check how long the endpoint takes with curl from the same machine.
- Check the port is reachable, and HTTPS_PROXY and NO_PROXY settings.
- Raise http.Client Timeout if the endpoint is legitimately slow, or fix the slow server.
Got a different message? Paste it into the error explainer.
Related errors
- requests.exceptions.ReadTimeout · The server took too long to respond
- java.net.SocketTimeoutException: Read timed out · The server took too long to send data
- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed · Python couldn't verify the server's certificate
- certificate verify failed: Hostname mismatch, certificate is not valid for · The certificate doesn't cover this hostname
- Max retries exceeded with url · requests gave up connecting to the URL
- socket.gaierror: [Errno -2] Name or service not known · Python couldn't resolve the hostname
- socket.gaierror: [Errno -3] Temporary failure in name resolution · Python couldn't reach a DNS resolver
- requests.exceptions.ConnectTimeout · Python couldn't open the connection in time
- ConnectionRefusedError: [Errno 111] Connection refused · Nothing is listening on that port
- http.client.RemoteDisconnected: Remote end closed connection without response · The server closed the connection without replying
- PKIX path building failed · Java can't build a trusted certificate chain
- javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure · The server rejected the TLS handshake