AlistGo/alist · error
failed to get uk from baidu youth cookie
Error message
failed to get uk from baidu youth cookie
What it means
Returned by BaiduYouth's credential bootstrap (drivers/baidu_youth/util.go:210): the account's uk (user id number) could not be determined from cookies or the userinfo response. The uk is used in download signatures (locatedownloadRand/Sign mix in d.uk), so without it no signed download is possible.
Source
Thrown at drivers/baidu_youth/util.go:210
}
if uk == 0 {
uk = int64(utils.Json.Get(body, "result", "uk").ToInt())
}
if bdstoken == "" {
bdstoken = utils.Json.Get(body, "result", "bdstoken").ToString()
}
if sk == "" {
sk = utils.Json.Get(body, "result", "sk").ToString()
}
}
if sk == "" {
sk, _ = d.getUserSK(ctx)
}
if bdstoken == "" {
return 0, "", "", fmt.Errorf("failed to get bdstoken from baidu youth cookie")
}
if uk == 0 {
return 0, "", "", fmt.Errorf("failed to get uk from baidu youth cookie")
}
return uk, bdstoken, sk, nil
}
func (d *BaiduYouth) getFiles(ctx context.Context, dir string) ([]File, error) {
page := 1
num := 1000
params := map[string]string{
"dir": dir,
}
if d.OrderBy != "" {
params["order"] = d.OrderBy
if d.OrderDirection == "desc" {
params["desc"] = "1"
} else {
params["desc"] = "0"
}
}View on GitHub (pinned to 843d9dc814)
Solutions
- Update the full cookie set in storage config (BDUSS + SToken) from a live browser session
- Confirm login works and the dashboard loads before copying cookies
- If it persists, dump (without secrets) which fields were found to see whether userinfo returned an error body
Defensive patterns
Strategy: validation
Validate before calling
if uk, _, _, err := d.getUserINFO(ctx); err != nil || uk == 0 {
return fmt.Errorf("baidu_youth cookies invalid (no uk): refresh BDUSS/SToken and re-add the storage")
} Prevention
- Refresh the whole cookie set when either uk or bdstoken is missing — both come from the same session
- Test new credentials with a cheap List call before automating downloads
- Avoid mixing cookies from different accounts (uk mismatch breaks signatures)
When it happens
Trigger: Same bootstrap path as the bdstoken error: userinfo call failed or its JSON lacked the uk field, and no cookie carried it. Typically the whole cookie set is invalid or expired, so every extraction comes back empty.
Common situations: Expired BDUSS; only a session cookie pasted without the full set; account-level API changes.
Related errors
- failed to get bdstoken from baidu youth cookie
- cookie is empty
- baidu youth sk is empty
- clientID and clientSecret are required in client_credentials
- api_key is empty
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/f805eb11ce7c488b.
Report an issue: GitHub.