AlistGo/alist · error

relative url without site url

Error message

relative url without site url: %s

What it means

readLinkBytes encountered a relative link URL that must be resolved against the site's API URL, but common.GetApiUrl returned empty (site URL not configured). The STRM payload cannot be built without an absolute URL.

Solutions

  1. Inspect the underlying error details in the message, fix the indicated cause (credentials, network, or provider-side failure), and retry.
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at drivers/strm/util.go:252

	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())
}

func (d *Strm) writeLocal(path string, payload []byte, mode string) error {
	if mode == SaveLocalInsertMode && utils.Exists(path) {
		return nil
	}

View on GitHub (pinned to 843d9dc814)