AlistGo/alist · error

empty link

Error message

empty link

What it means

readLinkBytes exhausted all link mechanisms (no MFile, no RangeReadCloser) and the URL field is empty, so there is no way to fetch the .strm payload; a sentinel guard against unusable links.

Solutions

  1. Ensure the referenced value is configured and non-empty, then retry the operation.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at drivers/strm/util.go:246 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/f3e7f58f362d2e59. Report an issue: GitHub.

Appendix: source

Thrown at drivers/strm/util.go:246

		return nil, err
	}
	return readLinkBytes(ctx, link)
}

func readLinkBytes(ctx context.Context, link *model.Link) ([]byte, error) {
	if link.MFile != nil {
		defer link.MFile.Close()
		return io.ReadAll(link.MFile)
	}
	if link.RangeReadCloser != nil {
		rc, err := link.RangeReadCloser.RangeRead(ctx, http_range.Range{Length: -1})
		if err == nil && rc != nil {
			defer rc.Close()
			return io.ReadAll(rc)
		}
	}
	if link.URL == "" {
		return nil, fmt.Errorf("empty link")
	}
	url := link.URL
	if !strings.HasPrefix(url, "http://") && !strings.HasPrefix(url, "https://") {
		api := common.GetApiUrl(nil)
		if api == "" {
			return nil, fmt.Errorf("relative url without site url: %s", url)
		}
		url = strings.TrimSuffix(api, "/") + url
	}
	res, err := base.RestyClient.R().SetContext(ctx).SetDoNotParseResponse(true).Get(url)
	if err != nil {
		return nil, err
	}
	defer res.RawBody().Close()
	if res.StatusCode() >= http.StatusBadRequest {
		return nil, fmt.Errorf("read url failed: status=%d", res.StatusCode())
	}
	return io.ReadAll(res.RawBody())

View on GitHub (pinned to 843d9dc814)