{"record":{"id":"2d52a3469686d374","repo":"chenhg5/cc-connect","slug":"download-w","errorCode":null,"errorMessage":"download: %w","messagePattern":"download: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/update.go","lineNumber":403,"sourceCode":"\t\treturn tmp.Name(), nil\n\t}\n\treturn \"\", fmt.Errorf(\"binary not found in archive\")\n}\n\nfunc downloadToTemp(url string) (string, error) {\n\tclient := &http.Client{\n\t\tTimeout: 5 * time.Minute,\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\tif len(via) >= 10 {\n\t\t\t\treturn fmt.Errorf(\"too many redirects\")\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tresp, err := client.Get(url)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"download: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn \"\", fmt.Errorf(\"download returned HTTP %d\", resp.StatusCode)\n\t}\n\n\ttmp, err := os.CreateTemp(\"\", \"cc-connect-update-*\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsize, err := io.Copy(tmp, resp.Body)\n\tif err != nil {\n\t\ttmp.Close()\n\t\tos.Remove(tmp.Name())\n\t\treturn \"\", fmt.Errorf(\"write: %w\", err)\n\t}","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/update.go#L385-L421","documentation":"Wraps a failed client.Get in downloadToTemp while fetching the release binary: the HTTP request itself errored (DNS failure, connection refused, TLS problem, timeout). The download aborts before any body is read.","triggerScenarios":"Thrown at cmd/cc-connect/update.go:403 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check network connectivity and DNS resolution to github.com","Retry — transient network faults are the usual cause","Use a proxy or manual download if GitHub is unreachable"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}