AlistGo/alist · error
MailCookies format is invalid, please check your configurati
Error message
MailCookies format is invalid, please check your configuration
What it means
MailCookies is non-empty but hasCookiePair() found no valid 'key=value' pair in it. The driver requires the cookie string to contain at least one k=v pair (in practice Os_SSo_Sid and RMKEY); free text, a bare session id, or a JSON blob fails this check.
Source
Thrown at drivers/139/util.go:1289
default:
return fmt.Errorf("unsupported credential state: %d", state)
}
}
func (d *Yun139) credentialState() (credentialState, error) {
d.Authorization = strings.TrimSpace(d.Authorization)
d.Username = strings.TrimSpace(d.Username)
d.MailCookies = strings.TrimSpace(d.MailCookies)
if d.Authorization != "" {
if strings.HasPrefix(strings.ToLower(d.Authorization), "basic ") {
return 0, fmt.Errorf("authorization should not include Basic prefix")
}
return credentialStateAuthorization, nil
}
if d.MailCookies != "" && !hasCookiePair(d.MailCookies) {
return 0, fmt.Errorf("MailCookies format is invalid, please check your configuration")
}
hasUsername := d.Username != ""
hasPassword := strings.TrimSpace(d.Password) != ""
hasCookies := d.MailCookies != ""
if hasUsername || hasPassword {
if !hasUsername || !hasPassword || !hasCookies {
return 0, fmt.Errorf("if username or password is provided, all three (mail_cookies, username, password) must be provided")
}
return credentialStateFullLogin, nil
}
if hasCookies {
return credentialStateCookiesOnly, nil
}
return 0, fmt.Errorf("authorization is empty and credentials are not provided")
}View on GitHub (pinned to 843d9dc814)
Solutions
- Re-copy cookies as 'Os_SSo_Sid=<val>; RMKEY=<val>' — name=value pairs joined by '; '
- In browser devtools use the 'Cookies' table and copy both name and value columns, or use 'Copy value' on the whole Cookie request header then strip the 'Cookie: ' prefix
- Save and reload the storage after fixing
Example fix
# before mail_cookies: "abc123sessionidvalueonly" # after mail_cookies: "Os_SSo_Sid=abc123; RMKEY=xyz456"
Defensive patterns
Strategy: validation
Validate before calling
// Reuse the driver's own predicate before init
if d.MailCookies != "" && !hasCookiePair(d.MailCookies) {
return errors.New("mail_cookies must look like 'name=value; name2=value2'")
} Type guard
func looksLikeCookieHeader(s string) bool {
s = strings.TrimSpace(s)
if strings.HasPrefix(strings.ToLower(s), "cookie:") { return false }
for _, part := range strings.Split(s, ";") {
if strings.Contains(strings.TrimSpace(part), "=") { return true }
}
return false
} Try / catch
// Fail fast with a config hint
if err != nil && strings.Contains(err.Error(), "MailCookies format is invalid") {
return errors.New("re-copy cookies as 'Os_SSo_Sid=...; RMKEY=...'")
} Prevention
- Copy the full cookie header value (minus 'Cookie:' prefix) from a logged-in browser session
- Never paste only cookie values without names
- Validate cookie strings in your provisioning scripts with the same pair check
When it happens
Trigger: Pasting only the RMKEY value without the 'Os_SSo_Sid=...' key part, pasting a whole 'Cookie:' header line including the header name, or pasting whitespace/format artifacts so no '=' survives parsing.
Common situations: Users new to cookie extraction copying the wrong devtools column ('Value' only instead of full 'name=value'), or concatenating cookies with newlines/commas instead of '; '.
Related errors
- remote_path is required
- chunk_size must be positive
- owner and repo are required
- committer email is required
- committer name is required
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/227d40b83f86e07c.
Report an issue: GitHub.