{"record":{"id":"49fffe42ff48bab8","repo":"cloudflare/cloudflared","slug":"failed-to-read-quick-tunnel-response","errorCode":null,"errorMessage":"failed to read quick-tunnel response","messagePattern":"failed to read quick-tunnel response","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/tunnel/quick_tunnel.go","lineNumber":80,"sourceCode":"\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\n\t\tif err := json.Unmarshal(respBody, &data); err == nil && len(data.Errors) > 0 {\n\t\t\treturn fmt.Errorf(\"quick tunnel provisioning failed with status %d: %s\", resp.StatusCode, formatQuickTunnelErrors(data.Errors))\n\t\t}\n\t\treturn fmt.Errorf(\"quick tunnel provisioning failed with status %d: %s\", resp.StatusCode, string(respBody))\n\t}\n\n\tvar data QuickTunnelResponse\n\tif err := json.Unmarshal(respBody, &data); err != nil {\n\t\trespString := string(respBody)\n\t\tfields := map[string]interface{}{\"status_code\": resp.Status}\n\t\tsc.log.Err(err).Fields(fields).Msgf(\"Error unmarshaling QuickTunnel response: %s\", respString)\n\t\treturn errors.Wrap(err, \"failed to unmarshal quick Tunnel\")\n\t}\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/tunnel/quick_tunnel.go#L62-L98","documentation":"Reading the body of the quick-tunnel provisioning response failed. cloudflared reads the whole response into memory (io.ReadAll) so it can surface it in error output; if the stream errors mid-read, this wrapped error is returned.","triggerScenarios":"io.ReadAll(resp.Body) returns an error after a successful client.Do — the connection was reset or timed out while reading the response body.","commonSituations":"Unstable networks or VPNs dropping the connection mid-response; proxies terminating the connection; server closing the connection prematurely under load.","solutions":["Retry the quick tunnel command — usually transient","Check for middleboxes/proxies that cut long-lived connections","Run with `--loglevel debug` and inspect the wrapped error for 'connection reset' or 'unexpected EOF'","If consistently reproducible, test the endpoint directly with curl"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"resp, err := client.Do(req)\nif err == nil {\n    if _, err := io.ReadAll(resp.Body); err != nil {\n        // treat as transient: retry with backoff\n        _ = resp.Body.Close()\n    }\n}","preventionTips":["Avoid running provisioning over flaky VPN/links","Disable middleboxes that reset idle connections","Retry once automatically on read errors"],"tags":["go","network","io","http"],"backgroundTag":"network-request-failed","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"}