AlistGo/alist · error

%d: %s

Error message

%d: %s

What it means

The generic non-200-code error from ILanZou's request wrapper: the JSON body's code field is not 200 and none of the retry conditions applied (already retried, not a proved call, code not in {-1,-2}, or token already present). Format 'code: msg' exposes the provider's numeric code and message. Codes -1/-2 (auth expiry) on proved routes trigger exactly one automatic re-login and retry before this error surfaces.

Source

Thrown at drivers/ilanzou/util.go:106

	if err != nil {
		if res != nil {
			log.Errorf("[iLanZou] request error: %s", res.String())
		}
		return nil, err
	}
	isRetry := len(retry) > 0 && retry[0]
	body := res.Body()
	code := utils.Json.Get(body, "code").ToInt()
	msg := utils.Json.Get(body, "msg").ToString()
	if code != 200 {
		if !isRetry && proved && (utils.SliceContains([]int{-1, -2}, code) || d.Token == "") {
			err = d.login()
			if err != nil {
				return nil, err
			}
			return d.request(pathname, method, callback, proved, true)
		}
		return nil, fmt.Errorf("%d: %s", code, msg)
	}
	return body, nil
}

func (d *ILanZou) unproved(pathname, method string, callback base.ReqCallback) ([]byte, error) {
	return d.request("/"+d.conf.unproved+pathname, method, callback, false)
}

func (d *ILanZou) proved(pathname, method string, callback base.ReqCallback) ([]byte, error) {
	return d.request("/"+d.conf.proved+pathname, method, callback, true)
}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Look up the numeric code in the embedded msg path — it is the provider's own taxonomy and points at the fix.
  2. Refresh the listing to get current IDs, then retry the operation.
  3. For repeated -1/-2 after auto-relogin, force a fresh login (clear Token) and check credentials — re-login may be silently failing elsewhere.
  4. Back off if the code indicates rate limiting; do not tight-loop retries.
Defensive patterns

Strategy: try-catch

Try / catch

body, err := d.proved(path, method, cb)
if err != nil {
    if code := extractCode(err); code == -1 || code == -2 {
        // wrapper already retried once; force relogin and try once more
        _ = d.login()
        body, err = d.proved(path, method, cb)
    }
    if err != nil { return classify(err) }
}

Prevention

When it happens

Trigger: Parameter errors (invalid folder/file IDs), permission failures, rate-limit codes, or auth codes appearing on unproved routes (which never re-login); a re-login that succeeded but the retry still returned non-200.

Common situations: Acting on object IDs from a stale directory listing; hitting per-hour API quotas; the account lacking the required operation rights; token expired while a proved retry loop exhausted its single attempt.

Related errors


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