{"record":{"id":"9b44617c3f22800b","repo":"AlistGo/alist","slug":"authorization-is-empty-and-credentials-are-not-pro","errorCode":null,"errorMessage":"authorization is empty and credentials are not provided","messagePattern":"authorization is empty and credentials are not provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/139/util.go","lineNumber":1306,"sourceCode":"\tif d.MailCookies != \"\" && !hasCookiePair(d.MailCookies) {\n\t\treturn 0, fmt.Errorf(\"MailCookies format is invalid, please check your configuration\")\n\t}\n\n\thasUsername := d.Username != \"\"\n\thasPassword := strings.TrimSpace(d.Password) != \"\"\n\thasCookies := d.MailCookies != \"\"\n\tif hasUsername || hasPassword {\n\t\tif !hasUsername || !hasPassword || !hasCookies {\n\t\t\treturn 0, fmt.Errorf(\"if username or password is provided, all three (mail_cookies, username, password) must be provided\")\n\t\t}\n\t\treturn credentialStateFullLogin, nil\n\t}\n\n\tif hasCookies {\n\t\treturn credentialStateCookiesOnly, nil\n\t}\n\n\treturn 0, fmt.Errorf(\"authorization is empty and credentials are not provided\")\n}\n\nfunc (d *Yun139) tryFastLoginWithCookies() bool {\n\tsid, rmkey := extractFastLoginCookies(d.MailCookies)\n\tif sid == \"\" || rmkey == \"\" {\n\t\tlog.Warnf(\"139yun: fast login skipped, required cookies missing: Os_SSo_Sid=%t RMKEY=%t\", sid != \"\", rmkey != \"\")\n\t\treturn false\n\t}\n\n\tlog.Infof(\"139yun: attempting fast login using existing SID/Cookies (Step 2).\")\n\ttoken, err := d.step2_get_single_token(sid)\n\tif err != nil || token == \"\" {\n\t\tlog.Warnf(\"139yun: fast login Step 2 failed: %v\", err)\n\t\treturn false\n\t}\n\n\tlog.Infof(\"139yun: Step 2 success. Proceeding to Step 3.\")\n\tauth, err := d.step3_third_party_login(token)","sourceCodeStart":1288,"sourceCodeEnd":1324,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/139/util.go#L1288-L1324","documentation":"credentialState() found no usable credential at all: Authorization empty, username empty, password empty, and mail_cookies empty. The driver has nothing to authenticate with and refuses to proceed.","triggerScenarios":"Newly created storage left with blank credential fields, all fields accidentally cleared, or values consisting only of whitespace (they are TrimSpace'd before the check).","commonSituations":"Testing storage creation without filling fields, fields lost when migrating/editing config, or whitespace-only paste from clipboard.","solutions":["Fill at least one valid credential: Authorization token, or complete mail_cookies (Os_SSo_Sid + RMKEY), or all three of mail_cookies/username/password","Prefer the Authorization token obtained from a working browser session for longest validity","Save and reload the storage"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Require at least one credential before mount\nif strings.TrimSpace(d.Authorization) == \"\" && strings.TrimSpace(d.MailCookies) == \"\" && d.Username == \"\" && strings.TrimSpace(d.Password) == \"\" {\n\treturn errors.New(\"configure at least one 139 credential\")\n}","typeGuard":"func hasAnyCredential(auth, mail, user, pass string) bool {\n\treturn strings.TrimSpace(auth) != \"\" || strings.TrimSpace(mail) != \"\" || strings.TrimSpace(user) != \"\" || strings.TrimSpace(pass) != \"\"\n}","tryCatchPattern":"// No recovery path — demand user input\nif err != nil && strings.Contains(err.Error(), \"credentials are not provided\") {\n\treturn errors.New(\"fill authorization, mail_cookies, or username/password in the 139 storage config\")\n}","preventionTips":["Make credential fields mandatory in your storage templates","Reject whitespace-only values in config validation before they reach the driver"],"tags":["config","validation","auth"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}