AlistGo/alist · error

request verification failed: %s

Error message

request verification failed: %s

What it means

Step one of SMS login preparation: POST to /v1/auth/verification to obtain a verification_id. Thrown when the response is an HTTP error, has an error field, or the VerificationID is empty. Before giving up the driver self-heals once: if the error mentions captcha_invalid or 'captcha_token expired' it force-refreshes the captcha token and retries the request.

Source

Thrown at drivers/guangyapan/driver.go:701

		SetContext(ctx).
		SetBody(map[string]any{
			"phone_number": normalizePhoneE164(d.PhoneNumber),
			"target":       "ANY",
			"client_id":    d.ClientID,
		}).
		SetResult(&step1).
		Post("/v1/auth/verification")
	if err != nil {
		return "", err
	}
	if resp.IsError() || step1.Error != "" || strings.TrimSpace(step1.VerificationID) == "" {
		// If captcha token is expired/invalid, refresh it once and retry.
		if strings.Contains(step1.Error, "captcha_invalid") || strings.Contains(step1.ErrorDesc, "captcha_token expired") {
			if err := d.ensureCaptchaToken(ctx, true); err == nil {
				return d.requestVerificationID(ctx)
			}
		}
		return "", fmt.Errorf("request verification failed: %s", d.accountErr(step1.ErrorDesc, step1.Error, resp))
	}
	return strings.TrimSpace(step1.VerificationID), nil
}

func (d *GuangYaPan) ensureCaptchaToken(ctx context.Context, force bool) error {
	if !force && d.CaptchaToken != "" {
		d.accountClient.SetHeader("X-Captcha-Token", d.CaptchaToken)
		return nil
	}

	var out captchaInitResp
	resp, err := d.accountClient.R().
		SetContext(ctx).
		SetBody(map[string]any{
			"client_id": d.ClientID,
			"action":    "POST:/v1/auth/verification",
			"device_id": d.DeviceID,
			"meta": map[string]any{

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Retry after a wait - the common cause is a stale captcha token and one retry may not be enough if the service is flaky.
  2. Reduce SMS request frequency to avoid provider throttling.
  3. If persistent, clear the stored captcha token and retry so ensureCaptchaToken does a fresh init.
Defensive patterns

Strategy: retry

Try / catch

if err := d.prepareSMSCode(ctx); err != nil {
    if strings.Contains(err.Error(), "request verification failed") {
        time.Sleep(2 * time.Second)
        // driver already self-heals captcha once; one outer retry covers flaky shields
        err = d.prepareSMSCode(ctx)
    }
    if err != nil {
        return err // persistent failure: likely rate limit or outage
    }
}

Prevention

When it happens

Trigger: prepareSMSCode -> requestVerificationID with a stale/missing X-Captcha-Token (the one-retry path fires and also fails), the phone number is rejected, rate limiting on SMS requests, or provider 5xx.

Common situations: Captcha token stored in driver config expired (they are short-lived) and the single automatic retry also failed; too many verification requests in a row trigger provider throttling; service outage.

Related errors


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