{"record":{"id":"1f8e283d0ca7e32d","repo":"MHSanaei/3x-ui","slug":"download-xray-unexpected-http-d","errorCode":null,"errorMessage":"download xray: unexpected HTTP %d","messagePattern":"download xray: unexpected HTTP (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/web/service/server.go","lineNumber":895,"sourceCode":"\t\tarch = \"32\"\n\tcase \"s390x\":\n\t\tarch = \"s390x\"\n\t}\n\n\tfileName := fmt.Sprintf(\"Xray-%s-%s.zip\", osName, arch)\n\turl := fmt.Sprintf(\"https://github.com/XTLS/Xray-core/releases/download/%s/%s\", version, fileName)\n\tclient := s.settingService.NewProxiedHTTPClient(60 * time.Second)\n\treq, reqErr := http.NewRequestWithContext(context.Background(), http.MethodGet, url, nil)\n\tif reqErr != nil {\n\t\treturn \"\", reqErr\n\t}\n\tresp, err := client.Do(req)\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(\"download xray: unexpected HTTP %d\", resp.StatusCode)\n\t}\n\tif resp.ContentLength > maxXrayArchiveBytes {\n\t\treturn \"\", fmt.Errorf(\"download xray: archive exceeds %d bytes\", maxXrayArchiveBytes)\n\t}\n\n\tfile, err := os.CreateTemp(\"\", \"xray-*.zip\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tpath := file.Name()\n\tok := false\n\tdefer func() {\n\t\t_ = file.Close()\n\t\tif !ok {\n\t\t\t_ = os.Remove(path)\n\t\t}\n\t}()\n","sourceCodeStart":877,"sourceCodeEnd":913,"githubUrl":"https://github.com/MHSanaei/3x-ui/blob/ad32144c42455696ea9f14e12168beac3e25f5d2/internal/web/service/server.go#L877-L913","documentation":"Returned by downloadXRay when the Xray release asset URL (https://github.com/XTLS/Xray-core/releases/download/<version>/<file>) responds with anything but 200. Most often a 404: the constructed asset name does not exist for that version — typically an unsupported GOOS/GOARCH combination or a version string that isn't a real release tag. Can also be 429 rate limiting on the redirect or proxy interference.","triggerScenarios":"Updating to a version from the list whose asset naming changed (e.g. new platform suffix); running on an OS/arch XTLS does not publish (so fileName maps to nothing); GitHub download CDN throttling (429).","commonSituations":"Exotic architectures (armv6, riscv) with no matching asset; version/prerelease tag published without assets yet; aggressive automated downloads hitting the CDN limit.","solutions":["Verify the asset exists: open https://github.com/XTLS/Xray-core/releases/tag/<version> and check the file list matches the requested OS/arch","Pick a version that ships assets for your platform","For 429, wait and retry; reduce automated update frequency"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the asset exists for this platform before updating\nassetURL := fmt.Sprintf(\"https://github.com/XTLS/Xray-core/releases/download/%s/%s\", version, fileName)\nif resp, err := client.Head(assetURL); err == nil && resp.StatusCode == http.StatusNotFound {\n    return fmt.Errorf(\"no xray asset for %s/%s at %s\", runtime.GOOS, runtime.GOARCH, version)\n}\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Select versions only from the fetched release list the panel shows","Confirm your OS/arch has published assets before scripting updates","Handle 429 from the CDN with backoff, not immediate retries"],"tags":["xray-update","download","github-api"],"backgroundTag":null,"analyzedSha":"ad32144c42455696ea9f14e12168beac3e25f5d2","analyzedAt":"2026-08-15T11:13:23.905Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}