{"record":{"id":"d77717759c18ecc2","repo":"AlistGo/alist","slug":"fast-login-with-cookies-failed-and-cannot-fallbac","errorCode":null,"errorMessage":"fast login with cookies failed, and cannot fallback to password login (missing username/password)","messagePattern":"fast login with cookies failed, and cannot fallback to password login \\(missing username/password\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/139/util.go","lineNumber":1263,"sourceCode":"}\n\nfunc (d *Yun139) validateAndInitCredentials() error {\n\tstate, err := d.credentialState()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch state {\n\tcase credentialStateAuthorization:\n\t\tlog.Debugf(\"139yun: Authorization exists, skipping initialization login.\")\n\t\treturn nil\n\tcase credentialStateFullLogin, credentialStateCookiesOnly:\n\t\tlog.Infof(\"139yun: Authorization missing, attempting login...\")\n\t\tif d.tryFastLoginWithCookies() {\n\t\t\treturn nil\n\t\t}\n\t\tif state == credentialStateCookiesOnly {\n\t\t\treturn fmt.Errorf(\"fast login with cookies failed, and cannot fallback to password login (missing username/password)\")\n\t\t}\n\t\tlog.Infof(\"139yun: fast login failed or not possible, performing full password login (Step 1).\")\n\t\t_, err := d.loginWithPassword()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"login with password failed: %w\", err)\n\t\t}\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported credential state: %d\", state)\n\t}\n}\n\nfunc (d *Yun139) credentialState() (credentialState, error) {\n\td.Authorization = strings.TrimSpace(d.Authorization)\n\td.Username = strings.TrimSpace(d.Username)\n\td.MailCookies = strings.TrimSpace(d.MailCookies)\n\n\tif d.Authorization != \"\" {","sourceCodeStart":1245,"sourceCodeEnd":1281,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/139/util.go#L1245-L1281","documentation":"The driver was configured with mail_cookies only (no username/password), fast login via existing SID/RMKEY cookies failed (step 2 or step 3 rejected them), and there is no fallback because password login requires credentials. This is a terminal configuration-state error, not a transient one.","triggerScenarios":"credentialState() returned credentialStateCookiesOnly and tryFastLoginWithCookies() returned false — Os_SSo_Sid or RMKEY missing from the cookie string, or the 139 server rejected the session as expired.","commonSituations":"User pasted incomplete cookies (missing RMKEY), cookies expired after ~days of idle, or copied cookies for a different account/region.","solutions":["Re-copy complete, fresh cookies: log into yun.139.com in the browser and take both Os_SSo_Sid and RMKEY (cookie format must be 'k=v; k=v')","If you want resilience against cookie expiry, switch the driver to full login: fill mail_cookies AND username AND password together","Verify there is no whitespace/newline or 'Cookie:' prefix pasted into the mail_cookies field","Restart/reload the storage after fixing config so login is re-attempted"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate cookies-only configuration before triggering login\nsid, rmkey := extractFastLoginCookies(d.MailCookies)\nif sid == \"\" || rmkey == \"\" {\n\treturn fmt.Errorf(\"mail_cookies lacks Os_SSo_Sid/RMKEY — fast login impossible; add username+password or refresh cookies\")\n}","typeGuard":"func hasFastLoginCookies(mailCookies string) bool {\n\tsid, rmkey := extractFastLoginCookies(mailCookies)\n\treturn sid != \"\" && rmkey != \"\"\n}","tryCatchPattern":"// Catch at storage-init level and surface an actionable config message\nif err := storage.Init(); err != nil {\n\tif strings.Contains(err.Error(), \"cannot fallback to password login\") {\n\t\treturn errors.New(\"139 cookies expired: re-copy Os_SSo_Sid/RMKEY from browser, or configure username+password\")\n\t}\n}","preventionTips":["Always copy both Os_SSo_Sid and RMKEY together","Prefer full-login config (cookies+username+password) for unattended setups","Refresh cookies on a schedule; they expire faster than Authorization tokens"],"tags":["config","auth","cookies","login"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}