Go "Client.Timeout exceeded while awaiting headers" in CI
A Go HTTP client sent the request and waited for response headers, but none arrived before its timeout. The connection was established, so this is a slow or unresponsive server or a proxy holding the request, not a connectivity failure.
What this error means
A Go tool (terraform, a provider, or a custom client) fails with "context deadline exceeded (Client.Timeout exceeded while awaiting headers)".
Get "https://api.example.com/v1/status": context deadline exceeded
(Client.Timeout exceeded while awaiting headers)Common causes
The server is slow to respond
The endpoint accepted the connection but took longer than the client timeout to produce headers, often under load.
A proxy holds the request without answering
An inspecting or buffering proxy delays forwarding the request, so headers arrive after the deadline.
How to fix it
Raise the client timeout for slow endpoints
If the endpoint is legitimately slow, increase the client timeout (via the tool's config or a longer deadline) so headers arrive in time.
# example: terraform provider request timeout
env:
TF_HTTP_CLIENT_TIMEOUT: '120'Confirm the endpoint responds at all
Test the same URL with a longer timeout to see whether it is slow or genuinely hung.
curl -sS --max-time 60 https://api.example.com/v1/status -o /dev/null -w '%{http_code} %{time_total}s\n'How to prevent it
- Set client timeouts that match real endpoint latency, not a default that is too tight.
- Avoid routing latency-sensitive calls through a buffering proxy where possible.
- Add retries so a transient slow response does not fail the whole job.