AlistGo/alist · error
invalid range
Error message
invalid range
What it means
Error "invalid range" thrown in AlistGo/alist.
Source
Thrown at internal/net/serve.go:105
// handle Content-Range header.
sendSize := size
var sendContent io.ReadCloser
ranges, err := http_range.ParseRange(rangeReq, size)
switch {
case err == nil:
case errors.Is(err, http_range.ErrNoOverlap):
if size == 0 {
// Some clients add a Range header to all requests to
// limit the size of the response. If the file is empty,
// ignore the range header and respond with a 200 rather
// than a 416.
ranges = nil
break
}
w.Header().Set("Content-Range", fmt.Sprintf("bytes */%d", size))
fallthrough
default:
http.Error(w, err.Error(), http.StatusRequestedRangeNotSatisfiable)
return nil
}
if sumRangesSize(ranges) > size {
// The total number of bytes in all the ranges is larger than the size of the file
// or unknown file size, ignore the range request.
ranges = nil
}
// 使用请求的Context
// 不然从sendContent读不到数据,即使请求断开CopyBuffer也会一直堵塞
ctx := context.WithValue(r.Context(), "request_header", r.Header)
switch {
case len(ranges) == 0:
reader, err := RangeReadCloser.RangeRead(ctx, http_range.Range{Length: -1})
if err != nil {
code = http.StatusRequestedRangeNotSatisfiable
if err == ErrExceedMaxConcurrency {View on GitHub (pinned to 843d9dc814)
Solutions
- Send a valid HTTP Range header within the file size bounds and retry the request.
When it happens
Trigger: Thrown at internal/net/serve.go:105 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/3c5e01abc4e1b9bb.
Report an issue: GitHub.