{"record":{"id":"48639d15b816db83","repo":"AlistGo/alist","slug":"cookie-is-empty","errorCode":null,"errorMessage":"cookie is empty","messagePattern":"cookie is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/yunpan360/driver.go","lineNumber":79,"sourceCode":"\td.Cookie = strings.TrimSpace(d.Cookie)\n\td.APIKey = strings.TrimSpace(d.APIKey)\n\td.OwnerQID = strings.TrimSpace(d.OwnerQID)\n\td.DownloadToken = strings.TrimSpace(d.DownloadToken)\n\td.cachedOpenAuth = nil\n\td.openAuthExpire = time.Time{}\n\td.cachedCookieSession = nil\n\td.cookieSessionExpire = time.Time{}\n\n\tswitch d.authMode() {\n\tcase authTypeAPIKey:\n\t\tif d.APIKey == \"\" {\n\t\t\treturn errors.New(\"api_key is empty\")\n\t\t}\n\t\t_, err := d.openUserInfo(ctx)\n\t\treturn err\n\tcase authTypeCookie:\n\t\tif d.Cookie == \"\" {\n\t\t\treturn errors.New(\"cookie is empty\")\n\t\t}\n\t\t// Web download URLs require browser-session headers; force local proxying\n\t\t// so AList can forward Referer/Origin instead of exposing a bare 302 URL.\n\t\td.WebProxy = true\n\t\t_, err := d.listCookiePage(ctx, d.RootFolderPath, 0, 1)\n\t\treturn err\n\tdefault:\n\t\treturn errors.New(\"invalid auth_type\")\n\t}\n}\n\nfunc (d *Yunpan360) Drop(ctx context.Context) error {\n\td.cachedOpenAuth = nil\n\td.openAuthExpire = time.Time{}\n\td.cachedCookieSession = nil\n\td.cookieSessionExpire = time.Time{}\n\treturn nil\n}","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/yunpan360/driver.go#L61-L97","documentation":"Thrown by Yunpan360 Init() when auth_type is \"cookie\" (the default) and the cookie field is empty after trimming. Cookie mode scrapes the web UI (listCookiePage and friends), which requires the browser session cookie; an empty cookie means every web request would land on a login page. Note Init also forces WebProxy=true in this mode because web download URLs need browser headers.","triggerScenarios":"Fresh storage config left with the default auth_type=cookie but no cookie pasted; the cookie string was accidentally cleared; switching from api_key to cookie mode without providing the session cookie.","commonSituations":"New mount created without completing credentials; user intended api_key mode but left auth_type at default; cookie stored elsewhere (password manager) and never pasted.","solutions":["Log in to yunpan.360.cn in a browser, copy the full Cookie header, and paste it into the cookie config field","If you have an open-API key instead, set auth_type=\"api_key\" and fill api_key","Re-save the config to trigger Init() validation"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if cfg.AuthType == \"cookie\" && strings.TrimSpace(cfg.Cookie) == \"\" {\n    return errors.New(\"auth_type=cookie requires a non-empty browser cookie\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Paste the full Cookie header from a logged-in yunpan.360.cn session","Remember cookie is the default auth_type — leaving it unset selects cookie mode","Cookie mode forces WebProxy; plan local proxy bandwidth for downloads"],"tags":["yunpan360","driver","config","auth","cookie","validation"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}