{"record":{"id":"2ec3cb077ce2d64d","repo":"ipfs/kubo","slug":"downloading-checksum-file-w","errorCode":null,"errorMessage":"downloading checksum file: %w","messagePattern":"downloading checksum file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/update_github.go","lineNumber":244,"sourceCode":"\t}\n\n\tdata, err := io.ReadAll(io.LimitReader(resp.Body, maxDownloadSize+1))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading download: %w\", err)\n\t}\n\tif int64(len(data)) > maxDownloadSize {\n\t\treturn nil, fmt.Errorf(\"download exceeds maximum size of %d bytes\", maxDownloadSize)\n\t}\n\treturn data, nil\n}\n\n// downloadAndVerifySHA512 downloads the .sha512 sidecar file for the given\n// archive URL and verifies the archive data against it.\nfunc downloadAndVerifySHA512(ctx context.Context, data []byte, archiveURL string) error {\n\tsha512URL := archiveURL + \".sha512\"\n\tchecksumData, err := downloadAsset(ctx, sha512URL)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"downloading checksum file: %w\", err)\n\t}\n\n\t// Parse \"<hex>  <filename>\\n\" format (standard sha512sum output).\n\tfields := strings.Fields(string(checksumData))\n\tif len(fields) < 1 {\n\t\treturn fmt.Errorf(\"empty or malformed .sha512 file\")\n\t}\n\twantHex := fields[0]\n\n\treturn verifySHA512(data, wantHex)\n}\n\n// verifySHA512 checks that data matches the given hex-encoded SHA-512 hash.\nfunc verifySHA512(data []byte, wantHex string) error {\n\twant, err := hex.DecodeString(wantHex)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid hex in SHA-512 checksum: %w\", err)\n\t}","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/update_github.go#L226-L262","documentation":"downloadAndVerifySHA512 fetches the `<archiveURL>.sha512` sidecar file via downloadAsset before verifying the archive; this error wraps any failure of that download (non-200 status, network error, oversized body), so the archive cannot be checksum-verified.","triggerScenarios":"The .sha512 sidecar is missing from the release (404), the checksum file is not yet uploaded while the archive is, GitHub rate-limits the second request, or the network drops during the checksum download.","commonSituations":"Updating immediately after a release where the archive was uploaded but the checksum sidecar is still propagating; deleted/partial releases; rate limiting because the updater makes several requests in quick succession.","solutions":["Wait and retry — the .sha512 sidecar may not be uploaded/propagated yet","Confirm the .sha512 file exists on the release page next to the archive","Check the inner error message: 'download returned HTTP 404' means the sidecar is missing; 429/5xx means retry later","If persistent, report the missing sidecar on the kubo release issue tracker"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify the sidecar URL responds 200 before starting the whole update\nresp, err := http.Head(archiveURL + \".sha512\")\nif err != nil || resp.StatusCode != http.StatusOK {\n\treturn fmt.Errorf(\".sha512 sidecar not available yet; retry later\")\n}","typeGuard":null,"tryCatchPattern":"err := runUpdate()\nif err != nil {\n\tif strings.Contains(err.Error(), \"downloading checksum file\") {\n\t\t// sidecar download failed; likely still uploading after a fresh release\n\t\treturn retryWithBackoff(runUpdate, 3)\n\t}\n\treturn err\n}","preventionTips":["Wait until the release page shows both the archive and its .sha512 file before updating","Back off on 429/5xx — the updater makes consecutive requests and can hit rate limits","Keep an unthrottled network path to github.com during updates","Fall back to manual download + `sha512sum -c` if the sidecar stays unavailable"],"tags":["network","github","checksum","download"],"backgroundTag":"checksum-file-download-failed","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}