{"record":{"id":"bec8b42f85068805","repo":"AlistGo/alist","slug":"http-request-failure-err-s","errorCode":null,"errorMessage":"http request failure, err:%s","messagePattern":"http request failure, err:(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/stream/util.go","lineNumber":41,"sourceCode":"\t\t\theader := net.ProcessHeader(nil, link.Header)\n\t\t\tdown := net.NewDownloader(func(d *net.Downloader) {\n\t\t\t\td.Concurrency = link.Concurrency\n\t\t\t\td.PartSize = link.PartSize\n\t\t\t})\n\t\t\treq := &net.HttpRequestParams{\n\t\t\t\tURL:       link.URL,\n\t\t\t\tRange:     r,\n\t\t\t\tSize:      size,\n\t\t\t\tHeaderRef: header,\n\t\t\t}\n\t\t\trc, err := down.Download(ctx, req)\n\t\t\treturn rc, err\n\n\t\t}\n\t\tresponse, err := RequestRangedHttp(ctx, link, r.Start, r.Length)\n\t\tif err != nil {\n\t\t\tif response == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"http request failure, err:%s\", err)\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tif r.Start == 0 && (r.Length == -1 || r.Length == size) || response.StatusCode == http.StatusPartialContent ||\n\t\t\tcheckContentRange(&response.Header, r.Start) {\n\t\t\treturn response.Body, nil\n\t\t} else if response.StatusCode == http.StatusOK {\n\t\t\tlog.Warnf(\"remote http server not supporting range request, expect low perfromace!\")\n\t\t\treadCloser, err := net.GetRangedHttpReader(response.Body, r.Start, r.Length)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn readCloser, nil\n\t\t}\n\n\t\treturn response.Body, nil\n\t}\n\tresultRangeReadCloser := model.RangeReadCloser{RangeReader: rangeReaderFunc}","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/internal/stream/util.go#L23-L59","documentation":"In the rangeReaderFunc used by GetRangeReadCloserFromLink, RequestRangedHttp failed AND returned a nil *http.Response, so the transport-level error is formatted as 'http request failure, err:%s'. Any response (even an error status) means the raw error is returned instead.","triggerScenarios":"Ranged GET to the link URL fails at network level: DNS failure, connection refused/reset, TLS handshake error, or the upstream server closing the connection before headers are sent.","commonSituations":"Expired pre-signed URLs from cloud drivers (S3/OSS/OneDrive), network egress blocked, upstream rate-limiting that drops connections, or a proxy (conf.ProxyUrl) being unreachable.","solutions":["Check the wrapped error text — it contains the Go net/http failure reason","If the link is an expiring signed URL, refresh the link (re-fetch the file) and retry the range read","Verify network/proxy settings and upstream availability","Retry the request — transient resets are common for large media streams"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"rc, err := rrc.RangeRead(ctx, r)\nif err != nil && strings.Contains(err.Error(), \"http request failure\") {\n    // network-level failure: refresh the (possibly expired) link, then retry with backoff\n}","preventionTips":["Re-fetch links when signed URLs may have expired instead of caching them long","Keep proxy settings valid and reachable","Wrap range reads in a bounded retry with link refresh"],"tags":["go","http","network","range-request","stream"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}