{"record":{"id":"4813b4abab565caa","repo":"MHSanaei/3x-ui","slug":"download-xray-checksum-unexpected-http-d","errorCode":null,"errorMessage":"download xray checksum: unexpected HTTP %d","messagePattern":"download xray checksum: unexpected HTTP (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/web/service/server.go","lineNumber":961,"sourceCode":"\n\tok = true\n\treturn path, nil\n}\n\n// fetchXrayDigestSHA256 downloads the .dgst sidecar XTLS publishes next to each\n// release asset and returns the SHA2-256 hex digest it lists.\nfunc (s *ServerService) fetchXrayDigestSHA256(client *http.Client, dgstURL string) (string, error) {\n\treq, reqErr := http.NewRequestWithContext(context.Background(), http.MethodGet, dgstURL, nil)\n\tif reqErr != nil {\n\t\treturn \"\", fmt.Errorf(\"download xray checksum: %w\", reqErr)\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"download xray checksum: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"download xray checksum: unexpected HTTP %d\", resp.StatusCode)\n\t}\n\traw, err := io.ReadAll(io.LimitReader(resp.Body, maxXrayDigestBytes))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"download xray checksum: %w\", err)\n\t}\n\treturn parseXrayDigestSHA256(raw)\n}\n\n// parseXrayDigestSHA256 extracts the lowercase SHA2-256 hex from an XTLS .dgst\n// file, whose lines are \"ALGO= <hex>\" (the relevant one being \"SHA2-256= ...\").\nfunc parseXrayDigestSHA256(dgst []byte) (string, error) {\n\tfor line := range strings.SplitSeq(string(dgst), \"\\n\") {\n\t\trest, ok := strings.CutPrefix(strings.TrimSpace(line), \"SHA2-256=\")\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\th := strings.ToLower(strings.TrimSpace(rest))\n\t\tif len(h) != 64 {","sourceCodeStart":943,"sourceCodeEnd":979,"githubUrl":"https://github.com/MHSanaei/3x-ui/blob/ad32144c42455696ea9f14e12168beac3e25f5d2/internal/web/service/server.go#L943-L979","documentation":"Returned by fetchXrayDigestSHA256 when the .dgst sidecar URL responds with a non-200 status. XTLS publishes a .dgst next to every release asset, so a 404 usually means the requested version is old enough to predate .dgst publishing, or the asset name is wrong; 429 is CDN rate limiting after the archive download consumed the budget.","triggerScenarios":"Updating to a legacy Xray version released before XTLS started publishing .dgst files (404); hitting GitHub's asset-CDN rate limit on the second request (429); proxy blocking the sidecar.","commonSituations":"Pinning old Xray versions for compatibility; automated updaters making many sequential downloads.","solutions":["Verify https://github.com/XTLS/Xray-core/releases/download/<version>/<file>.dgst exists in a browser","Choose a newer version that ships .dgst sidecars","For 429, wait before retrying; slow the update cadence"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if resp, err := client.Head(dgstURL); err == nil && resp.StatusCode == http.StatusNotFound {\n    // this version predates .dgst publishing — pick a newer release\n}\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin to Xray versions known to publish .dgst sidecars when integrity checks are mandatory","Rate-limit automated downloads so the CDN does not 429 the sidecar fetch"],"tags":["xray-update","checksum","github-api"],"backgroundTag":null,"analyzedSha":"ad32144c42455696ea9f14e12168beac3e25f5d2","analyzedAt":"2026-08-15T11:13:23.905Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}