AlistGo/alist · error

captcha type %s not support

Error message

captcha type %s not support

What it means

Thrown during Cloudreve v4 login when the site requires a captcha. The driver fetches /site/config/basic; only the built-in "normal" (base64 PNG image) captcha is implemented — any other captcha_type (e.g. recaptcha, turnstile, or a plugin captcha) cannot be solved programmatically, so login aborts before requesting a ticket.

Source

Thrown at drivers/cloudreve_v4/util.go:137

		}
	}
	return err
}

func (d *CloudreveV4) doLogin(needCaptcha bool) error {
	var err error
	loginBody := base.Json{
		"email":    d.Username,
		"password": d.Password,
	}
	if needCaptcha {
		var config BasicConfigResp
		err = d.request(http.MethodGet, "/site/config/basic", nil, &config)
		if err != nil {
			return err
		}
		if config.CaptchaType != "normal" {
			return fmt.Errorf("captcha type %s not support", config.CaptchaType)
		}
		var captcha CaptchaResp
		err = d.request(http.MethodGet, "/site/captcha", nil, &captcha)
		if err != nil {
			return err
		}
		if !strings.HasPrefix(captcha.Image, "data:image/png;base64,") {
			return errors.New("can not get captcha")
		}
		loginBody["ticket"] = captcha.Ticket
		i := strings.Index(captcha.Image, ",")
		dec := base64.NewDecoder(base64.StdEncoding, strings.NewReader(captcha.Image[i+1:]))
		vRes, err := base.RestyClient.R().SetMultipartField(
			"image", "validateCode.png", "image/png", dec).
			Post(setting.GetStr(conf.OcrApi))
		if err != nil {
			return err
		}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. In Cloudreve v4 admin settings, switch the captcha to the built-in normal image captcha (or disable captcha) so the driver can fetch and solve it
  2. Prefer API-token/session-based auth (provide a valid refresh/ access token) so login with captcha is never triggered
  3. Keep the session alive by refreshing tokens before they expire, avoiding the login path entirely
Defensive patterns

Strategy: validation

Validate before calling

// pre-flight: check the site's captcha mode before attempting silent login
var config BasicConfigResp
if err := d.request(http.MethodGet, "/site/config/basic", nil, &config); err == nil {
    if config.CaptchaType != "" && config.CaptchaType != "normal" {
        return fmt.Errorf("site requires unsupported captcha %q; use token auth instead", config.CaptchaType)
    }
}

Type guard

func captchaSolvable(t string) bool { return t == "" || t == "normal" }

Try / catch

if err := d.login(); err != nil {
    if strings.Contains(err.Error(), "captcha type") {
        // no automated fix: instruct user to change captcha or provide a token; do not retry
        return err
    }
}

Prevention

When it happens

Trigger: Calling login() against a Cloudreve v4 instance whose admin enabled a non-normal captcha (Cloudflare Turnstile, reCAPTCHA, or a custom captcha provider) while the driver's needCaptcha path is active (no valid session/refresh token yet).

Common situations: Site owner hardens the Cloudreve login with Turnstile after the alist storage was configured; the stored token expired, forcing re-login through the captcha path; targeting a Cloudreve v4 instance with a captcha plugin installed.

Related errors


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