{"record":{"id":"600ad17eecfa7e3e","repo":"hasura/graphql-engine","slug":"failed-to-create-get-request-to-s-w","errorCode":null,"errorMessage":"failed to create GET request to %s: %w","messagePattern":"failed to create GET request to (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/util/server.go","lineNumber":130,"sourceCode":"\t\t}\n\n\t\tif len(r) >= 1 {\n\t\t\tstate.UUID = r[0].UUID\n\t\t\tstate.CLIState = r[0].CLIState\n\t\t}\n\t}\n\n\treturn state\n}\n\nfunc GetServerStatus(versionEndpoint string, httpClient *httpc.Client) (err error) {\n\tvar op errors.Op = \"util.GetServerStatus\"\n\n\treq, err := http.NewRequest(http.MethodGet, versionEndpoint, nil)\n\tif err != nil {\n\t\treturn errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\"failed to create GET request to %s: %w\", versionEndpoint, err),\n\t\t)\n\t}\n\n\tvar responseBs bytes.Buffer\n\n\tresp, err := httpClient.Do(context.Background(), req, &responseBs)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"making http request failed: %w\", err))\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\n\t\t\t\t\"request failed: url: %s status code: %v status: %s \\n%s\",\n\t\t\t\tversionEndpoint,\n\t\t\t\tresp.StatusCode,\n\t\t\t\tresp.Status,","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/util/server.go#L112-L148","documentation":"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.","triggerScenarios":"Calling GetServerStatus when the configured server URL/versionEndpoint is empty, missing a scheme (http://), contains spaces or control characters, or fails RFC 3986 parsing.","commonSituations":"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.","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."],"exampleFix":"// before\nu := fmt.Sprintf(\"%s/version\", cfg.ServerURL) // cfg.ServerURL = \"localhost:8080\"\n\n// after\nif !strings.Contains(cfg.ServerURL, \"://\") {\n    cfg.ServerURL = \"http://\" + cfg.ServerURL\n}\nu := strings.TrimSpace(cfg.ServerURL) + \"/version\"","handlingStrategy":"validation","validationCode":"u, err := url.Parse(serverURL)\nif err != nil || u.Scheme == \"\" || u.Host == \"\" {\n    return fmt.Errorf(\"invalid server URL %q: must be like http://host:port\", serverURL)\n}","typeGuard":null,"tryCatchPattern":"if _, err := util.GetServerStatus(ep); err != nil {\n    if _, perr := url.Parse(ep); perr != nil {\n        return fmt.Errorf(\"config error: malformed server URL %q\", ep)\n    }\n    return err\n}","preventionTips":["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."],"tags":["go","url-parsing","http","configuration"],"backgroundTag":"invalid-url","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}