AlistGo/alist · error

err.Error()

Error message

err.Error()

What it means

ServeHTTP could not obtain a reader for the whole content from RangeReadCloser.RangeRead when no valid ranges apply; the request is answered 416 (or 429 if the error is ErrExceedMaxConcurrency). The thrown value is the underlying error's own message, relayed via http.Error.

Solutions

  1. Check the storage configuration and the provider's service status, fix the indicated cause, and retry the operation.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/net/serve.go:126 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/fd049a9a81afe5fd. Report an issue: GitHub.

Appendix: source

Thrown at internal/net/serve.go:126

	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 {
				code = http.StatusTooManyRequests
			}
			http.Error(w, err.Error(), code)
			return nil
		}
		sendContent = reader
	case len(ranges) == 1:
		// RFC 7233, Section 4.1:
		// "If a single part is being transferred, the server
		// generating the 206 response MUST generate a
		// Content-Range header field, describing what range
		// of the selected representation is enclosed, and a
		// payload consisting of the range.
		// ...
		// A server MUST NOT generate a multipart response to
		// a request for a single range, since a client that
		// does not request multiple parts might not support
		// multipart responses."
		ra := ranges[0]
		sendContent, err = RangeReadCloser.RangeRead(ctx, ra)
		if err != nil {

View on GitHub (pinned to 843d9dc814)