AlistGo/alist · error

authorization is empty and credentials are not provided

Error message

authorization is empty and credentials are not provided

What it means

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.

Source

Thrown at drivers/139/util.go:1306

	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")
}

func (d *Yun139) tryFastLoginWithCookies() bool {
	sid, rmkey := extractFastLoginCookies(d.MailCookies)
	if sid == "" || rmkey == "" {
		log.Warnf("139yun: fast login skipped, required cookies missing: Os_SSo_Sid=%t RMKEY=%t", sid != "", rmkey != "")
		return false
	}

	log.Infof("139yun: attempting fast login using existing SID/Cookies (Step 2).")
	token, err := d.step2_get_single_token(sid)
	if err != nil || token == "" {
		log.Warnf("139yun: fast login Step 2 failed: %v", err)
		return false
	}

	log.Infof("139yun: Step 2 success. Proceeding to Step 3.")
	auth, err := d.step3_third_party_login(token)

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Fill at least one valid credential: Authorization token, or complete mail_cookies (Os_SSo_Sid + RMKEY), or all three of mail_cookies/username/password
  2. Prefer the Authorization token obtained from a working browser session for longest validity
  3. Save and reload the storage
Defensive patterns

Strategy: validation

Validate before calling

// Require at least one credential before mount
if strings.TrimSpace(d.Authorization) == "" && strings.TrimSpace(d.MailCookies) == "" && d.Username == "" && strings.TrimSpace(d.Password) == "" {
	return errors.New("configure at least one 139 credential")
}

Type guard

func hasAnyCredential(auth, mail, user, pass string) bool {
	return strings.TrimSpace(auth) != "" || strings.TrimSpace(mail) != "" || strings.TrimSpace(user) != "" || strings.TrimSpace(pass) != ""
}

Try / catch

// No recovery path — demand user input
if err != nil && strings.Contains(err.Error(), "credentials are not provided") {
	return errors.New("fill authorization, mail_cookies, or username/password in the 139 storage config")
}

Prevention

When it happens

Trigger: 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).

Common situations: Testing storage creation without filling fields, fields lost when migrating/editing config, or whitespace-only paste from clipboard.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/9b44617c3f22800b. Report an issue: GitHub.