Skip to content
MtrXTools

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

  1. Check how long the endpoint takes with curl from the same machine.
  2. Check the port is reachable, and HTTPS_PROXY and NO_PROXY settings.
  3. Raise http.Client Timeout if the endpoint is legitimately slow, or fix the slow server.
Measure connection latency

Got a different message? Paste it into the error explainer.

Related errors

All 32 Languages & runtimes errors