{"record":{"id":"15ea80c50018e792","repo":"cloudflare/cloudflared","slug":"failed-to-build-quick-tunnel-request","errorCode":null,"errorMessage":"failed to build quick tunnel request","messagePattern":"failed to build quick tunnel request","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/tunnel/quick_tunnel.go","lineNumber":66,"sourceCode":"\tallowedMail := sc.c.StringSlice(flags.AllowedMail)\n\tisProtected := len(allowedMail) > 0\n\n\tclient := http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSHandshakeTimeout:   httpTimeout,\n\t\t\tResponseHeaderTimeout: httpTimeout,\n\t\t},\n\t\tTimeout: httpTimeout,\n\t}\n\n\treqBody, err := buildQuickTunnelRequestBody(isProtected)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to build quick tunnel request body\")\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, fmt.Sprintf(\"%s/tunnel\", sc.c.String(\"quick-service\")), bytes.NewReader(reqBody))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to build quick tunnel request\")\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"User-Agent\", buildInfo.UserAgent())\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to request quick Tunnel\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\t// This will read the entire response into memory so we can print it in case of error\n\trespBody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to read quick-tunnel response\")\n\t}\n\n\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\tvar data QuickTunnelResponse","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/tunnel/quick_tunnel.go#L48-L84","documentation":"RunQuickTunnel fails while constructing the HTTP POST request to the quick-tunnel service (`<quick-service>/tunnel`). This happens when http.NewRequest cannot build a request, typically because the quick-service URL is malformed. The error wraps the underlying cause with this message.","triggerScenarios":"http.NewRequest returns an error for the POST to `sc.c.String(\"quick-service\")+\"/tunnel\"`, e.g. when the `quick-service` config flag is set to an unparseable URL.","commonSituations":"Users set a custom `quick-service` URL in their config file or via environment override with a typo, unsupported scheme, or invalid characters; default value is normally valid so this is rare.","solutions":["Check the `quick-service` config value for typos and ensure it is a valid absolute http(s) URL","Revert to the default quick-service URL by removing the override from config/flags","Look at the wrapped inner error (printed by errors.Wrap) for the exact URL parse failure","Upgrade cloudflared in case of a packaged default-value corruption"],"exampleFix":"// before\nquick-service: \"trycloudflare.com\"   // missing scheme\n// after\nquick-service: \"https://api.trycloudflare.com\"","handlingStrategy":"validation","validationCode":"qs := sc.c.String(\"quick-service\")\nif u, err := url.Parse(qs); err != nil || u.Scheme == \"\" || u.Host == \"\" {\n    return fmt.Errorf(\"invalid quick-service URL: %q\", qs)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never override quick-service unless testing; when you do, use a full https:// URL","Validate config URLs at startup","Keep cloudflared updated"],"tags":["go","network","cli","url"],"backgroundTag":"invalid-url-format","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}