{"record":{"id":"3cd6bebe80167027","repo":"AlistGo/alist","slug":"uid-variable-not-find","errorCode":null,"errorMessage":"uid variable not find","messagePattern":"uid variable not find","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/lanzou/util.go","lineNumber":587,"sourceCode":"\tsize, _ := strconv.ParseInt(res.Header().Get(\"Content-Length\"), 10, 64)\n\treturn &size, &time\n}\n\nfunc (d *LanZou) getVeiAndUid() (vei string, uid string, err error) {\n\t// mydisk.php 同样可能返回 acw_sc__v2 反爬挑战页,需经 getHtml 处理后再解析\n\thtml, err := d.getHtml(\"https://pc.woozooo.com/mydisk.php\", func(req *resty.Request) {\n\t\treq.SetQueryParams(map[string]string{\n\t\t\t\"item\":   \"files\",\n\t\t\t\"action\": \"index\",\n\t\t})\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\t// uid\n\tuids := regexp.MustCompile(`uid=([^'\"&;]+)`).FindStringSubmatch(html)\n\tif len(uids) < 2 {\n\t\terr = fmt.Errorf(\"uid variable not find\")\n\t\treturn\n\t}\n\tuid = uids[1]\n\n\t// vei\n\tdata, err := htmlJsonToMap(html)\n\tif err != nil {\n\t\treturn\n\t}\n\tvei = data[\"vei\"]\n\n\treturn\n}\n","sourceCodeStart":569,"sourceCodeEnd":601,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/lanzou/util.go#L569-L601","documentation":"Thrown by the lanzou driver's login/account bootstrap when fetching https://pc.woozooo.com/mydisk.php?item=files&action=index and the returned HTML does not contain a 'uid=\"...\"' assignment (regex `uid=([^'\"&;]+)`). The uid is required for subsequent account API calls (listing, managing files on your own lanzou account storage).","triggerScenarios":"Creating/initializing a lanzou storage that uses account cookies (Cookie filled in addition) when the mydisk.php response lacks the uid variable: invalid or expired cookies, a redirect to the login page, or a WAF/verification page returned by pc.woozooo.com.","commonSituations":"Cookie string pasted incorrectly or missing key entries (phpdisk_info / ylogin), cookies expired (lanzou sessions rotate), IP flagged by the WAF, or a lanzou frontend change to the mydisk page markup.","solutions":["Log in to pc.woozooo.com in a browser, copy the full fresh Cookie header, and update the storage's Cookie field.","Verify the cookie works by opening https://pc.woozizzo.com/mydisk.php?item=files&action=index while logged out of other sessions — it must show the file list, not a login form.","If the browser shows a slider captcha, complete it, then re-copy cookies.","Update OpenList/AList in case the uid extraction regex was fixed upstream."],"exampleFix":"// before: stale cookies -> login page HTML -> no uid -> error\n// after: refresh cookie and pre-validate before saving storage\n// (browser check) curl -s 'https://pc.woozooo.com/mydisk.php?item=files&action=index' \\\n//   -H 'Cookie: <your cookie>' | grep -o 'uid=[^\"&;]*'\n// must print a uid; otherwise refresh the cookie","handlingStrategy":"validation","validationCode":"// Before saving the storage, verify cookies yield a uid\nhtml, _ := getHtmlWithCookie(\"https://pc.woozooo.com/mydisk.php?item=files&action=index\", cookie)\nif len(regexp.MustCompile(`uid=([^'\"&;]+)`).FindStringSubmatch(html)) < 2 {\n    return errors.New(\"cookie invalid: no uid in mydisk page; refresh cookie\")\n}","typeGuard":null,"tryCatchPattern":"if err := d.Init(ctx); err != nil {\n    if strings.Contains(err.Error(), \"uid variable not find\") {\n        // prompt user to re-paste cookie instead of retrying\n        return promptReauth(\"lanzou cookie expired\")\n    }\n}","preventionTips":["Refresh lanzou cookies on a schedule; sessions expire.","Copy the complete Cookie header from a logged-in pc.woozooo.com tab.","Complete any slider captcha in the same browser before copying cookies."],"tags":["lanzou","authentication","cookie","web-scraping","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}