{"record":{"id":"f805eb11ce7c488b","repo":"AlistGo/alist","slug":"failed-to-get-uk-from-baidu-youth-cookie","errorCode":null,"errorMessage":"failed to get uk from baidu youth cookie","messagePattern":"failed to get uk from baidu youth cookie","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/baidu_youth/util.go","lineNumber":210,"sourceCode":"\t\t}\n\t\tif uk == 0 {\n\t\t\tuk = int64(utils.Json.Get(body, \"result\", \"uk\").ToInt())\n\t\t}\n\t\tif bdstoken == \"\" {\n\t\t\tbdstoken = utils.Json.Get(body, \"result\", \"bdstoken\").ToString()\n\t\t}\n\t\tif sk == \"\" {\n\t\t\tsk = utils.Json.Get(body, \"result\", \"sk\").ToString()\n\t\t}\n\t}\n\tif sk == \"\" {\n\t\tsk, _ = d.getUserSK(ctx)\n\t}\n\tif bdstoken == \"\" {\n\t\treturn 0, \"\", \"\", fmt.Errorf(\"failed to get bdstoken from baidu youth cookie\")\n\t}\n\tif uk == 0 {\n\t\treturn 0, \"\", \"\", fmt.Errorf(\"failed to get uk from baidu youth cookie\")\n\t}\n\treturn uk, bdstoken, sk, nil\n}\n\nfunc (d *BaiduYouth) getFiles(ctx context.Context, dir string) ([]File, error) {\n\tpage := 1\n\tnum := 1000\n\tparams := map[string]string{\n\t\t\"dir\": dir,\n\t}\n\tif d.OrderBy != \"\" {\n\t\tparams[\"order\"] = d.OrderBy\n\t\tif d.OrderDirection == \"desc\" {\n\t\t\tparams[\"desc\"] = \"1\"\n\t\t} else {\n\t\t\tparams[\"desc\"] = \"0\"\n\t\t}\n\t}","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/baidu_youth/util.go#L192-L228","documentation":"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.","triggerScenarios":"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.","commonSituations":"Expired BDUSS; only a session cookie pasted without the full set; account-level API changes.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if uk, _, _, err := d.getUserINFO(ctx); err != nil || uk == 0 {\n    return fmt.Errorf(\"baidu_youth cookies invalid (no uk): refresh BDUSS/SToken and re-add the storage\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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)"],"tags":["baidu-youth","config","cookie","auth"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}