hasura/graphql-engine · error
making http request failed: %w
Error message
making http request failed: %w
What it means
GetServerStatus's HTTP round trip itself failed: httpClient.Do returned an error before receiving a response (cli/util/server.go:138). This wraps transport-level failures — DNS resolution, refused connections, TLS handshake errors, timeouts, or cancelled contexts — not HTTP error statuses.
Source
Thrown at cli/util/server.go:138
return state
}
func GetServerStatus(versionEndpoint string, httpClient *httpc.Client) (err error) {
var op errors.Op = "util.GetServerStatus"
req, err := http.NewRequest(http.MethodGet, versionEndpoint, nil)
if err != nil {
return errors.E(
op,
fmt.Errorf("failed to create GET request to %s: %w", versionEndpoint, err),
)
}
var responseBs bytes.Buffer
resp, err := httpClient.Do(context.Background(), req, &responseBs)
if err != nil {
return errors.E(op, fmt.Errorf("making http request failed: %w", err))
}
if resp.StatusCode != http.StatusOK {
return errors.E(
op,
fmt.Errorf(
"request failed: url: %s status code: %v status: %s \n%s",
versionEndpoint,
resp.StatusCode,
resp.Status,
responseBs.String(),
),
)
}
return nil
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Verify the server is up and reachable: curl http://<host>:<port>/version from the same machine/env.
- Fix host/port in the CLI config or start the server if it's local.
- For TLS errors, install/trust the CA or point to the correct https endpoint.
- Increase the HTTP client timeout if the endpoint is slow, and add retry with backoff for transient failures.
Example fix
// before
status, err := util.GetServerStatus(url)
if err != nil { return err }
// after
var status *Status
err := retry(3, time.Second, func() error {
var e error
status, e = util.GetServerStatus(url)
return e
})
if err != nil { return fmt.Errorf("server unreachable: %w", err) } Defensive patterns
Strategy: retry
Validate before calling
conn, err := net.DialTimeout("tcp", hostPort, 2*time.Second)
if err != nil { return fmt.Errorf("server not reachable: %w", err) }
conn.Close() Try / catch
var st *Status
err := retry(3, 500*time.Millisecond, func() error {
var e error
st, e = util.GetServerStatus(u)
return e
})
if err != nil { return fmt.Errorf("server unreachable after retries: %w", err) } Prevention
- Health-check the server before running commands that depend on it.
- Set a sane HTTP client timeout so failures surface quickly.
- Add exponential backoff retry for transient network blips.
- In Kubernetes, wait for readiness probes before invoking the CLI.
When it happens
Trigger: Calling GetServerStatus (used by the Validate and Execute command paths) when the server is not running, the host doesn't resolve, a TLS certificate is invalid, or the request exceeds the client's timeout.
Common situations: The backend server process is stopped or starting up; wrong host/port in config; self-signed cert without proper trust; firewall or proxy blocking the port; Kubernetes pod not ready; DNS entry missing in the environment.
Related errors
- exporting metadata from server: %w
- reading metadata from response: %w
- determining server metadata inconsistency: %w
- reading metadata from response: %w
- failed to obtain plugin archive: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/297542b72816050d.
Report an issue: GitHub.