hasura/graphql-engine · error
failed to create GET request to %s: %w
Error message
failed to create GET request to %s: %w
What it means
GetServerStatus fails before any network traffic: http.NewRequest could not construct a GET request for the version endpoint URL (cli/util/server.go:130). This almost always means the endpoint URL is malformed — bad scheme, control characters, or an unparseable URL — rather than a connectivity problem.
Source
Thrown at cli/util/server.go:130
}
if len(r) >= 1 {
state.UUID = r[0].UUID
state.CLIState = r[0].CLIState
}
}
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,View on GitHub (pinned to 724551b9ae)
Solutions
- Print/inspect the server URL configuration actually in effect (config file, env var) and fix scheme/host/port.
- Ensure the URL includes a valid scheme, e.g. http://localhost:8080, with no whitespace or control characters.
- Add config validation at startup so a malformed URL fails fast with a clear message.
- If a recent version changed config keys, migrate the old setting to the new key name.
Example fix
// before
u := fmt.Sprintf("%s/version", cfg.ServerURL) // cfg.ServerURL = "localhost:8080"
// after
if !strings.Contains(cfg.ServerURL, "://") {
cfg.ServerURL = "http://" + cfg.ServerURL
}
u := strings.TrimSpace(cfg.ServerURL) + "/version" Defensive patterns
Strategy: validation
Validate before calling
u, err := url.Parse(serverURL)
if err != nil || u.Scheme == "" || u.Host == "" {
return fmt.Errorf("invalid server URL %q: must be like http://host:port", serverURL)
} Try / catch
if _, err := util.GetServerStatus(ep); err != nil {
if _, perr := url.Parse(ep); perr != nil {
return fmt.Errorf("config error: malformed server URL %q", ep)
}
return err
} Prevention
- Validate the server URL at config load time with net/url.Parse.
- Trim whitespace/newlines from URLs read from config files.
- Fail fast on empty scheme or host instead of reaching the HTTP layer.
When it happens
Trigger: Calling GetServerStatus when the configured server URL/versionEndpoint is empty, missing a scheme (http://), contains spaces or control characters, or fails RFC 3986 parsing.
Common situations: SOCKS/server URL env var or config field misspelled or empty; URL copied with a trailing space or newline; config defaulting to a placeholder like 'http://:8080' or missing port/host after an upgrade changed the config format.
Related errors
- making http request failed: %w
- request failed: url: %s status code: %v status: %s %s
- Error while building the request for the pre-response plugin
- cannot create seeds directory: %w
- expected a valid url for --api-host, parsing error: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/600ad17eecfa7e3e.
Report an issue: GitHub.