AlistGo/alist · error

dynamic: fmt.Errorf(info) - message passthrough from API…

Error message

dynamic: fmt.Errorf(info) - message passthrough from API 'inf'/'info' JSON field

What it means

Dynamic application-level error from the LanZou _post layer: when the response JSON's zt code is not 1/2/4 (success/retry) and not 9 (cookie expiration), the driver surfaces the server's own message from the 'inf' or 'info' JSON field via fmt.Errorf(info). The error text is therefore whatever LanZou reported.

Solutions

  1. Read the message itself — it is LanZou's own reason and usually decisive (e.g. wrong password, file deleted)
  2. If it mentions password, supply/correct the share password in the driver or link config
  3. If it mentions deletion/invalidity, remove or fix the affected share link
  4. Slow down request rates if the message indicates abuse control
Defensive patterns

Strategy: try-catch

Try / catch

// driver-internal pattern already: zt==9 maps to ErrCookieExpiration with auto re-login;
// callers should key on sentinel errors first
if err := d.post(url, cb, &resp); err != nil {
    if errors.Is(err, ErrCookieExpiration) { /* handled by post() retry */ }
    // otherwise err.Error() IS lanzou's own 'inf'/'info' message
}

Prevention

When it happens

Trigger: Any LanZou AJAX endpoint returning a non-success zt: file not found, wrong share password, 'file is canceled' / 'file does not exist' style messages, or rate-limit responses — everything except the dedicated zt==9 expiry path.

Common situations: Expired/deleted share links; wrong or missing share password; heavy usage triggering LanZou anti-abuse; folder ID no longer accessible to the account.

Related errors


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

Appendix: source

Thrown at drivers/lanzou/util.go:93

	}, up)
	if err != nil {
		return data, err
	}
	switch utils.Json.Get(data, "zt").ToInt() {
	case 1, 2, 4:
		if resp != nil {
			// 返回类型不统一,忽略错误
			utils.Json.Unmarshal(data, resp)
		}
		return data, nil
	case 9: // 登录过期
		return data, ErrCookieExpiration
	default:
		info := utils.Json.Get(data, "inf").ToString()
		if info == "" {
			info = utils.Json.Get(data, "info").ToString()
		}
		return data, fmt.Errorf(info)
	}
}

func (d *LanZou) request(url string, method string, callback base.ReqCallback, up bool) ([]byte, error) {
	var client *resty.Client
	if up {
		once.Do(func() {
			upClient = base.NewRestyClient().SetTimeout(120 * time.Second)
		})
		client = upClient
	} else {
		client = base.RestyClient
	}

	// acw_sc__v2 反爬挑战可能出现在任意页面/接口(分享页、iframe 页、ajaxm.php 等)。
	// 挑战页内嵌 arg1,需据此算出 cookie 后用同一请求重试,故在最底层统一处理。
	var acwScV2 string
	var body []byte

View on GitHub (pinned to 843d9dc814)