# Go: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

**Code:** `Client.Timeout exceeded while awaiting headers` · **Category:** Go · **Seen on:** Go

An `http.Client` with a Timeout gave up waiting for the server's response headers.

## Meaning

The server was slow or hung, or the client Timeout is too short. `http.Client.Timeout` covers the whole exchange including body read. Use `Transport` settings (`ResponseHeaderTimeout`, `DialContext`) for finer control and never use the default client without a timeout in production.

## Common causes

- Slow upstream API
- Timeout too short
- Network partition or DNS slowness
- Large response body reading time included
- Overloaded server behind a proxy

## Quick fix

1. Raise `Client.Timeout` or tune `ResponseHeaderTimeout`
2. Retry idempotent requests with backoff
3. Add observability for upstream latency

## Detailed fix by platform

### Go

1. `client := &http.Client{Timeout: 15 * time.Second}`

## How to diagnose

1. **Phase** — Dial, headers or body?
2. **Value** — Reasonable?
3. **Upstream** — Slow?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/go/client-timeout-exceeded)
