AlistGo/alist · error

baidu youth locatedownload url not found for %s

Error message

baidu youth locatedownload url not found for %s

What it means

Returned by BaiduYouth's locatedownload step (drivers/baidu_youth/util.go:436): the /youth/api/locatedownload request succeeded (errno 0) but resp.URL came back empty. The call is signed with rand/sign derived from sk, uk, fileMD5, fileID and the current time — an empty URL with errno 0 typically means the signature inputs were wrong or stale so Baidu returned success-shaped emptiness.

Source

Thrown at drivers/baidu_youth/util.go:436

}

func (d *BaiduYouth) requestLocateDownloadURL(ctx context.Context, path string, fileID string, fileMD5 string, sk string) (string, error) {
	nowMilli := time.Now().UnixMilli()

	var resp LocateDownloadResp
	_, err := d.get(ctx, "/youth/api/locatedownload", map[string]string{
		"devuid":   "0",
		"dp-logid": nextDPLogID(),
		"path":     path,
		"rand":     d.locatedownloadRand(sk, nowMilli),
		"sign":     d.locatedownloadSign(fileMD5, fileID, nowMilli),
		"time":     strconv.FormatInt(nowMilli, 10),
	}, &resp)
	if err != nil {
		return "", err
	}
	if resp.URL == "" {
		return "", fmt.Errorf("baidu youth locatedownload url not found for %s", path)
	}
	return normalizeLocatedownloadURL(resp.URL)
}

func (d *BaiduYouth) getLocateDownloadURL(ctx context.Context, file model.Obj) (string, error) {
	path, fileID, fileMD5, err := d.resolveDownloadMeta(ctx, file)
	if err != nil {
		return "", err
	}

	sk, err := d.getCurrentUserSK(ctx)
	if err != nil {
		return "", err
	}
	downloadURL, err := d.requestLocateDownloadURL(ctx, path, fileID, fileMD5, sk)
	if err == nil {
		return downloadURL, nil
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Re-resolve file metadata (path/fs_id/md5) immediately before the download request
  2. Refresh sk (re-init with fresh cookies) and retry
  3. Ensure NTP-synced clock; retry once with a new timestamp
  4. Confirm the uk used in signatures matches the cookie owner
Defensive patterns

Strategy: retry

Try / catch

url, err := d.getLocateDownloadURL(ctx, file)
if err != nil && strings.Contains(err.Error(), "locatedownload url not found") {
    // signature inputs may be stale: refresh sk + metadata, then one retry
    if ierr := d.Init(ctx); ierr == nil {
        d.resolveCache.Delete(file.GetPath())
        url, err = d.getLocateDownloadURL(ctx, file)
    }
}

Prevention

When it happens

Trigger: Wrong sk (see 'baidu youth sk is empty' path feeding a bad cached value), wrong uk, md5/fileID mismatch from stale metadata, or clock skew between nowMilli signing and Baidu's window.

Common situations: Expired sk cached across days; server clock drift; file renamed/moved between resolve and download so path/md5 no longer match.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/d7bde7734d32d62a. Report an issue: GitHub.