hasura/graphql-engine · error
request failed: url: %s status code: %v status: %s %s
Error message
request failed: url: %s status code: %v status: %s %s
What it means
GetServerStatus received an HTTP response whose status code is not 200 from the version endpoint (cli/util/server.go:144). The message includes the URL, status code, status text, and the response body, so the body usually reveals the server-side reason (error page, JSON error, auth challenge).
Source
Thrown at cli/util/server.go:144
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
- Read the response body in the error message — it typically names the exact server-side cause.
- Map the status: 401/403 -> fix/refresh credentials; 404 -> correct the base URL/path or upgrade the server; 5xx -> check server logs.
- If behind a proxy, verify the upstream is healthy (the 502/503 is from the proxy, not the app).
- Confirm the server version is new enough to expose the version endpoint.
Example fix
// before
st, err := util.GetServerStatus(u)
if err != nil { return err }
// after
st, err := util.GetServerStatus(u)
if err != nil {
if strings.Contains(err.Error(), "status code: 401") {
return fmt.Errorf("credentials rejected — run 'cli login': %w", err)
}
return err
} Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight with plain http to surface status early
resp, err := http.Get(ep) //nolint
if err == nil {
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("endpoint unhealthy (HTTP %d) — check server/auth before continuing", resp.StatusCode)
}
} Try / catch
_, err := util.GetServerStatus(u)
if err != nil && strings.Contains(err.Error(), "status code:") {
sc := extractStatusCode(err)
switch {
case sc == 401 || sc == 403:
return fmt.Errorf("auth failed — refresh credentials: %w", err)
case sc == 404:
return fmt.Errorf("endpoint not found — check base URL/server version: %w", err)
case sc >= 500:
return fmt.Errorf("server error — check server logs: %w", err)
}
} Prevention
- Parse the status code and body from the message to route to the right fix.
- Keep credentials fresh and validate them at startup.
- Verify the server version exposes the endpoint you're calling.
- Monitor 5xx rates behind proxies to distinguish backend vs proxy failures.
When it happens
Trigger: Calling GetServerStatus when the endpoint returns 401/403 (auth required or bad token), 404 (wrong path or server version without the endpoint), 500 (server-side crash), or 502/503 (proxy/gateway in front of an unhealthy server).
Common situations: API token expired or missing so a gateway returns 401/403; reverse proxy (nginx/ingress) returning 502 because the backend is down; hitting an old server version that lacks /version; typo'd base path producing 404.
Related errors
- failed to create GET request to %s: %w
- making http request failed: %w
- Header '{0}', used in the auth config, is not a valid header
- Header value '{0}' is not a valid header value for header '{
- Unexpected status code: {0}
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/fc71855fdcaedddf.
Report an issue: GitHub.