{"record":{"id":"4c9a54a74971122f","repo":"github/copilot-sdk","slug":"failed-to-download-w","errorCode":null,"errorMessage":"failed to download: %w","messagePattern":"failed to download: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":1004,"sourceCode":"\treturn checksum, nil\n}\n\n// downloadCLIBinary downloads the verified release package and extracts the CLI binary. It\n// returns the extracted binary path and the downloaded tarball path (retained so\n// callers can extract additional files, such as the runtime library).\nfunc downloadCLIBinary(runtimePlatform, binaryName, cliVersion, destDir string) (string, string, error) {\n\tassetName := releaseAssetName(cliVersion, runtimePlatform)\n\texpectedChecksum, err := getReleaseChecksum(cliVersion, assetName)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\ttarballURL := releaseDownloadURL(cliVersion, assetName)\n\n\tfmt.Printf(\"Downloading from %s...\\n\", tarballURL)\n\n\tresp, err := releaseHTTPClient.Get(tarballURL)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"failed to download: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", \"\", fmt.Errorf(\"failed to download: %s\", resp.Status)\n\t}\n\n\t// Save tarball to temp file\n\ttarballPath := filepath.Join(destDir, assetName)\n\ttarballFile, err := os.Create(tarballPath)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"failed to create tarball file: %w\", err)\n\t}\n\n\thasher := sha256.New()\n\tif _, err := io.Copy(io.MultiWriter(tarballFile, hasher), resp.Body); err != nil {\n\t\ttarballFile.Close()\n\t\treturn \"\", \"\", fmt.Errorf(\"failed to save tarball: %w\", err)","sourceCodeStart":986,"sourceCodeEnd":1022,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L986-L1022","documentation":"Returned by downloadCLIBinary when fetching the verified CLI release tarball fails (network error, bad download URL, HTTP failure, or interrupted transfer) after the release checksum was resolved. The wrapped cause identifies the underlying download error; callers such as buildBundle treat it as a fatal bundle failure.","triggerScenarios":"releaseHTTPClient.Get(tarballURL) fails with a transport error: DNS failure, connection refused/reset, TLS handshake error, timeout, or offline environment.","commonSituations":"Build machine without internet or behind a blocking proxy; wrong release host in baseURL; VPN/firewall dropping large downloads; transient upstream outage.","solutions":["Verify network/proxy connectivity (curl -I the tarball URL)","Confirm cliVersion and baseURL are correct so the URL is valid","Add retry-with-backoff around the download for transient errors","Check HTTPS_PROXY/HTTP_PROXY env and corporate CA certs for TLS failures"],"exampleFix":"// before\nresp, err := releaseHTTPClient.Get(tarballURL)\nif err != nil {\n\treturn \"\", \"\", fmt.Errorf(\"failed to download: %w\", err)\n}\n// after\nvar resp *http.Response\nfor attempt := 0; attempt < 3; attempt++ {\n\tresp, err = releaseHTTPClient.Get(tarballURL)\n\tif err == nil {\n\t\tbreak\n\t}\n\ttime.Sleep(time.Duration(attempt+1) * time.Second)\n}\nif err != nil {\n\treturn \"\", \"\", fmt.Errorf(\"failed to download after retries: %w\", err)\n}","handlingStrategy":"retry","validationCode":"u, err := url.Parse(releaseDownloadURL(cliVersion, assetName))\nif err != nil {\n\treturn fmt.Errorf(\"invalid release URL: %w\", err)\n}\nresp, err := http.Head(u.String())\nif err != nil || resp.StatusCode != http.StatusOK {\n\treturn fmt.Errorf(\"release asset unreachable: %s\", u)\n}","typeGuard":null,"tryCatchPattern":"resp, err := releaseHTTPClient.Get(tarballURL)\nif err != nil {\n\tvar netErr net.Error\n\tif errors.As(err, &netErr) && netErr.Timeout() {\n\t\t// exponential backoff retry\n\t}\n\treturn \"\", \"\", fmt.Errorf(\"failed to download: %w\", err)\n}","preventionTips":["Pre-flight check the tarball URL with curl/HEAD in CI before long builds","Configure proxy env vars and corporate CA certs on build machines","Add bounded retry with backoff for transient transport errors","Pin versions and mirror releases internally for reliability"],"tags":["network","download","http","go"],"backgroundTag":"network-request-failed","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}