{"record":{"id":"c16953489434bd07","repo":"github/copilot-sdk","slug":"failed-to-read-checksums-w","errorCode":null,"errorMessage":"failed to read checksums: %w","messagePattern":"failed to read checksums: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":977,"sourceCode":"\nfunc getReleaseChecksum(version, assetName string) (string, error) {\n\tbaseURL := cliDownloadBaseURL()\n\tcacheKey := baseURL + \"\\x00\" + version\n\tchecksums, ok := releaseChecksumCache[cacheKey]\n\tif !ok {\n\t\tchecksumsURL := fmt.Sprintf(\"%s/v%s/SHA256SUMS.txt\", baseURL, version)\n\t\tfmt.Printf(\"Downloading checksums from %s...\\n\", checksumsURL)\n\t\tresp, err := releaseHTTPClient.Get(checksumsURL)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to download checksums: %w\", err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\treturn \"\", fmt.Errorf(\"failed to download checksums: %s\", resp.Status)\n\t\t}\n\t\tcontents, err := io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to read checksums: %w\", err)\n\t\t}\n\t\tchecksums = parseReleaseChecksums(string(contents))\n\t\treleaseChecksumCache[cacheKey] = checksums\n\t}\n\tchecksum, ok := checksums[assetName]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"SHA256SUMS.txt does not contain %s\", assetName)\n\t}\n\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 {","sourceCodeStart":959,"sourceCodeEnd":995,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L959-L995","documentation":"Reading the SHA256SUMS.txt response body failed; the error is wrapped so the underlying I/O cause is preserved. getReleaseChecksum cannot parse checksums without the full body, so downloadCLIBinary aborts.","triggerScenarios":"io.ReadAll(resp.Body) returns an error while draining the checksums response: connection reset mid-body, timeout during transfer, or server closing the connection early.","commonSituations":"Flaky network or proxy dropping long-running responses; server truncating the response; aggressive HTTP client timeout on slow links.","solutions":["Retry the build — mid-body resets are usually transient","Increase the HTTP client timeout for release downloads","Check proxy/firewall stability for large-ish text downloads from the release host","Verify the release host itself is healthy (curl the checksums URL repeatedly)"],"exampleFix":"// before\ncontents, err := io.ReadAll(resp.Body)\nif err != nil {\n\treturn \"\", fmt.Errorf(\"failed to read checksums: %w\", err)\n}\n// after\ncontents, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))\nif err != nil {\n\treturn \"\", fmt.Errorf(\"failed to read checksums: %w\", err)\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"contents, err := io.ReadAll(resp.Body)\nif err != nil {\n\tvar netErr net.Error\n\tif errors.As(err, &netErr) && netErr.Timeout() {\n\t\t// retry once before failing\n\t}\n\treturn \"\", fmt.Errorf(\"failed to read checksums: %w\", err)\n}","preventionTips":["Set explicit timeouts on releaseHTTPClient and retry on timeout errors","Avoid flaky proxies for release downloads","Read with io.LimitReader to bound response size","Check server health if resets recur on the same host"],"tags":["network","http","io","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"}