AlistGo/alist · error

failed to obtain verification code

Error message

failed to obtain verification code

What it means

Raised in Cloud189PC.initLoginParam when the picCaptcha.do request for the login captcha image fails (transport error): the captcha image could not be downloaded, so the login flow cannot proceed and OCR/fallback is skipped.

Solutions

  1. Check the storage configuration and the provider's service status, fix the indicated cause, and retry the operation.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at drivers/189pc/utils.go:436 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at drivers/189pc/utils.go:436

			"userName":    param.RsaUsername,
		}).Post(AUTH_URL + "/api/logbox/oauth2/needcaptcha.do")
	if err != nil {
		return err
	}
	if resp.String() == "0" {
		return nil
	}

	// 拉取验证码
	imgRes, err := y.client.R().
		SetQueryParams(map[string]string{
			"token": param.CaptchaToken,
			"REQID": param.ReqId,
			"rnd":   fmt.Sprint(timestamp()),
		}).
		Get(AUTH_URL + "/api/logbox/oauth2/picCaptcha.do")
	if err != nil {
		return fmt.Errorf("failed to obtain verification code")
	}
	if imgRes.Size() > 20 {
		if setting.GetStr(conf.OcrApi) != "" && !y.NoUseOcr {
			vRes, err := base.RestyClient.R().
				SetMultipartField("image", "validateCode.png", "image/png", bytes.NewReader(imgRes.Body())).
				Post(setting.GetStr(conf.OcrApi))
			if err != nil {
				return err
			}
			if jsoniter.Get(vRes.Body(), "status").ToInt() == 200 {
				y.VCode = jsoniter.Get(vRes.Body(), "result").ToString()
				return nil
			}
		}

		// 返回验证码图片给前端
		return fmt.Errorf(`need img validate code: <img src="data:image/png;base64,%s"/>`, base64.StdEncoding.EncodeToString(imgRes.Body()))
	}

View on GitHub (pinned to 843d9dc814)