{"record":{"id":"5680c42c54f56a09","repo":"xpzouying/xiaohongshu-mcp","slug":"sha256sums-http-d","errorCode":null,"errorMessage":"获取 SHA256SUMS: HTTP %d","messagePattern":"获取 SHA256SUMS: HTTP (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browser/browser_download.go","lineNumber":157,"sourceCode":"\th := sha256.New()\n\tif _, err := io.Copy(h, f); err != nil {\n\t\treturn err\n\t}\n\tgot := hex.EncodeToString(h.Sum(nil))\n\tif !strings.EqualFold(got, want) {\n\t\treturn fmt.Errorf(\"%s SHA256 不匹配：期望 %s，实际 %s\", asset, want, got)\n\t}\n\treturn nil\n}\n\nfunc fetchExpectedSHA(asset string) (string, error) {\n\tresp, err := (&http.Client{Timeout: 30 * time.Second}).Get(browserURL(\"SHA256SUMS\"))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"获取 SHA256SUMS: HTTP %d\", resp.StatusCode)\n\t}\n\tsc := bufio.NewScanner(resp.Body)\n\tfor sc.Scan() {\n\t\t// 格式：<hash>␠␠<filename>\n\t\tfields := strings.Fields(sc.Text())\n\t\tif len(fields) == 2 && fields[1] == asset {\n\t\t\treturn fields[0], nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"SHA256SUMS 中未找到 %s\", asset)\n}\n\nfunc findBinary(dir, binName string) string {\n\tvar found string\n\t_ = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil || info.IsDir() {\n\t\t\treturn nil\n\t\t}","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/browser/browser_download.go#L139-L175","documentation":"fetchExpectedSHA fetches the SHA256SUMS checksum file published alongside browser assets and parses lines of the form '<hash>␠␠<filename>'. This error is thrown when the HTTP response status is not 200 OK, meaning the checksum manifest could not be retrieved from the download server.","triggerScenarios":"EnsureBrowser -> verifySHA256 -> fetchExpectedSHA performs http.Get(browserURL(\"SHA256SUMS\")) and the server responds with a status other than 200 (e.g. 404, 403, 5xx) while the request itself succeeds at the transport level.","commonSituations":"The upstream browser download CDN changed its layout so SHA256SUMS no longer exists at the expected path; a corporate proxy or mirror returns 403; transient CDN 5xx during an outage; the configured browser version/URL points to an untagged or removed release.","solutions":["Check that the resolved browserURL(\"SHA256SUMS\") actually exists by fetching it manually with curl and inspecting the status code","Retry later if the status is 5xx — it is usually a transient CDN/server issue","If behind a proxy, verify the proxy allows GET to that host/path and does not inject an auth redirect (401/403)","Clear any cached/pinned browser version and let EnsureBrowser resolve a currently published version","Update the library/download URL base if the upstream project moved its release assets"],"exampleFix":"// before\nresp, err := (&http.Client{Timeout: 30 * time.Second}).Get(browserURL(\"SHA256SUMS\"))\n// after — inspect status before treating it as fatal, allow a retry\nfor i := 0; i < 3; i++ {\n\tresp, err := (&http.Client{Timeout: 30 * time.Second}).Get(browserURL(\"SHA256SUMS\"))\n\tif err == nil && resp.StatusCode == http.StatusOK {\n\t\tbreak\n\t}\n\ttime.Sleep(time.Second * time.Duration(i+1))\n}","handlingStrategy":"retry","validationCode":"url := browserURL(\"SHA256SUMS\")\nresp, err := http.Head(url)\nif err != nil || resp.StatusCode != http.StatusOK {\n\t// 上游清单不可用，跳过校验或延后重试\n}","typeGuard":null,"tryCatchPattern":"expected, err := fetchExpectedSHA(asset)\nif err != nil {\n\tif strings.Contains(err.Error(), \"HTTP \") {\n\t\t// 网络/服务端问题：等待后重试\n\t\ttime.Sleep(5 * time.Second)\n\t\texpected, err = fetchExpectedSHA(asset)\n\t}\n\tif err != nil { return fmt.Errorf(\"校验失败: %w\", err) }\n}","preventionTips":["Before verifying, HEAD-request the SHA256SUMS URL to check availability","Distinguish retryable (5xx/429) from permanent (404/403) statuses","Avoid pinning browser versions that may be deleted upstream","Log the full URL on failure to speed diagnosis"],"tags":["network","http","download","checksum"],"backgroundTag":"http-non-200-response","analyzedSha":"332d196854a9eac0d2b8c2c0e3d0cc43139d724c","analyzedAt":"2026-09-05T22:22:55.988Z","contentChangedAt":"2026-09-05T22:22:55.988Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}