{"record":{"id":"d7bde7734d32d62a","repo":"AlistGo/alist","slug":"baidu-youth-locatedownload-url-not-found-for-s","errorCode":null,"errorMessage":"baidu youth locatedownload url not found for %s","messagePattern":"baidu youth locatedownload url not found for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/baidu_youth/util.go","lineNumber":436,"sourceCode":"}\n\nfunc (d *BaiduYouth) requestLocateDownloadURL(ctx context.Context, path string, fileID string, fileMD5 string, sk string) (string, error) {\n\tnowMilli := time.Now().UnixMilli()\n\n\tvar resp LocateDownloadResp\n\t_, err := d.get(ctx, \"/youth/api/locatedownload\", map[string]string{\n\t\t\"devuid\":   \"0\",\n\t\t\"dp-logid\": nextDPLogID(),\n\t\t\"path\":     path,\n\t\t\"rand\":     d.locatedownloadRand(sk, nowMilli),\n\t\t\"sign\":     d.locatedownloadSign(fileMD5, fileID, nowMilli),\n\t\t\"time\":     strconv.FormatInt(nowMilli, 10),\n\t}, &resp)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif resp.URL == \"\" {\n\t\treturn \"\", fmt.Errorf(\"baidu youth locatedownload url not found for %s\", path)\n\t}\n\treturn normalizeLocatedownloadURL(resp.URL)\n}\n\nfunc (d *BaiduYouth) getLocateDownloadURL(ctx context.Context, file model.Obj) (string, error) {\n\tpath, fileID, fileMD5, err := d.resolveDownloadMeta(ctx, file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsk, err := d.getCurrentUserSK(ctx)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdownloadURL, err := d.requestLocateDownloadURL(ctx, path, fileID, fileMD5, sk)\n\tif err == nil {\n\t\treturn downloadURL, nil\n\t}","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/baidu_youth/util.go#L418-L454","documentation":"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.","triggerScenarios":"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.","commonSituations":"Expired sk cached across days; server clock drift; file renamed/moved between resolve and download so path/md5 no longer match.","solutions":["Re-resolve file metadata (path/fs_id/md5) immediately before the download request","Refresh sk (re-init with fresh cookies) and retry","Ensure NTP-synced clock; retry once with a new timestamp","Confirm the uk used in signatures matches the cookie owner"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"url, err := d.getLocateDownloadURL(ctx, file)\nif err != nil && strings.Contains(err.Error(), \"locatedownload url not found\") {\n    // signature inputs may be stale: refresh sk + metadata, then one retry\n    if ierr := d.Init(ctx); ierr == nil {\n        d.resolveCache.Delete(file.GetPath())\n        url, err = d.getLocateDownloadURL(ctx, file)\n    }\n}","preventionTips":["Resolve path/fs_id/md5 immediately before signing — never reuse cached values across renames","Keep clocks NTP-synced; the signature includes the current millisecond timestamp","Verify the sk belongs to the same account (uk) that owns the files"],"tags":["baidu-youth","download","signing","api"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}