{"record":{"id":"5fc012c487da0f01","repo":"AlistGo/alist","slug":"authorization-should-not-include-basic-prefix","errorCode":null,"errorMessage":"authorization should not include Basic prefix","messagePattern":"authorization should not include Basic prefix","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/139/util.go","lineNumber":1283,"sourceCode":"\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 != \"\" {\n\t\tif strings.HasPrefix(strings.ToLower(d.Authorization), \"basic \") {\n\t\t\treturn 0, fmt.Errorf(\"authorization should not include Basic prefix\")\n\t\t}\n\t\treturn credentialStateAuthorization, nil\n\t}\n\n\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","sourceCodeStart":1265,"sourceCodeEnd":1301,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/139/util.go#L1265-L1301","documentation":"credentialState() detected that the Authorization field starts with 'Basic ' (case-insensitive). The 139 driver expects the raw Authorization token value only — it sends it directly in headers — so a Basic-auth prefixed string is a user configuration mistake, not a server condition.","triggerScenarios":"User copied 'Basic <token>' from browser devtools/curl examples into the storage's Authorization field instead of just the token.","commonSituations":"Following documentation for a different driver or HTTP examples that show the full header value 'Authorization: Basic xxxx' and pasting it verbatim.","solutions":["Edit the storage config and remove the 'Basic ' prefix, keeping only the token string","Save and reload the storage so login state is re-evaluated","If unsure what the token is, extract just the value from the Authorization header shown in browser devtools (strip scheme and space)"],"exampleFix":"# before (config)\nauthorization: \"Basic aaaabbbb...\"\n# after\nauthorization: \"aaaabbbb...\"","handlingStrategy":"validation","validationCode":"// Check before saving the storage config\nif strings.HasPrefix(strings.ToLower(strings.TrimSpace(auth)), \"basic \") {\n\treturn errors.New(\"authorization must be the bare token, without the 'Basic ' prefix\")\n}","typeGuard":"func isBareToken(auth string) bool {\n\tauth = strings.TrimSpace(auth)\n\treturn auth != \"\" && !strings.HasPrefix(strings.ToLower(auth), \"basic \")\n}","tryCatchPattern":"// Config errors need user action, not retries — surface immediately\nif err != nil && strings.Contains(err.Error(), \"Basic prefix\") {\n\treturn errors.New(\"remove the 'Basic ' prefix from the Authorization field\")\n}","preventionTips":["Copy only the token value from devtools, not the full header line","Add the same prefix check to your config validation tooling before submission"],"tags":["config","validation","auth"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}